Add note saved and note too large toast messages
authorAdam Dullage <redacted>
Fri, 10 May 2024 11:39:34 +0000 (12:39 +0100)
committerAdam Dullage <redacted>
Fri, 10 May 2024 11:39:34 +0000 (12:39 +0100)
client/views/Note.vue

index 3a40f55fbce2e72c1f0230f7acbf7a849a091c0d..0bc25cbeb0874e0d0699f1ab9ec6e742a48045e0 100644 (file)
@@ -164,6 +164,7 @@ function deleteHandler() {
 function deleteConfirmedHandler() {
   deleteNote(note.value.title)
     .then(() => {
+      toast.add(getToastOptions("Success", "Note deleted."));
       router.push({ name: "home" });
     })
     .catch((error) => {
@@ -216,7 +217,7 @@ function saveExisting(newTitle, newContent) {
 }
 
 function noteSaveFailure(error) {
-  if (error.response.status === 409) {
+  if (error.response?.status === 409) {
     toast.add(
       getToastOptions(
         "Duplicate",
@@ -224,6 +225,14 @@ function noteSaveFailure(error) {
         true,
       ),
     );
+  } else if (error.response?.status === 413) {
+    toast.add(
+      getToastOptions(
+        "Failure",
+        "This note is too large. Please try again with a smaller note or adjust your server configuration.",
+        true,
+      ),
+    );
   } else {
     apiErrorHandler(error, toast);
   }
git clone https://git.99rst.org/PROJECT