From: Adam Dullage Date: Fri, 10 May 2024 11:39:34 +0000 (+0100) Subject: Add note saved and note too large toast messages X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=31cca97f53d4e492696ba972f4bc09aff62221fa;p=flatnotes.git Add note saved and note too large toast messages --- diff --git a/client/views/Note.vue b/client/views/Note.vue index 3a40f55..0bc25cb 100644 --- a/client/views/Note.vue +++ b/client/views/Note.vue @@ -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); }