Add message when deleting note. Resolves #10.
authorAdam Dullage <redacted>
Tue, 28 Jun 2022 19:27:22 +0000 (20:27 +0100)
committerAdam Dullage <redacted>
Tue, 28 Jun 2022 19:27:22 +0000 (20:27 +0100)
flatnotes/src/components/App.js

index fc3eece009b0cd2e06a45fdffeebec9a58136d4a..96347fbf628fabd9303eb894860b71bd187deac9 100644 (file)
@@ -131,7 +131,7 @@ export default {
     },
 
     getSearchResults: function() {
-      var parent = this;
+      let parent = this;
       api
         .get("/api/search", { params: { term: this.searchTerm } })
         .then(function(response) {
@@ -279,14 +279,19 @@ export default {
     },
 
     deleteNote: function() {
+      let parent = this;
       if (
         confirm(
           `Are you sure you want to delete the note '${this.currentNote.title}'?`
         )
       ) {
-        api
-          .delete(`/api/notes/${this.currentNote.filename}`)
-          .then(this.navigate("/"));
+        api.delete(`/api/notes/${this.currentNote.filename}`).then(function() {
+          parent.navigate("/");
+          parent.$bvToast.toast("Note Deleted ✓", {
+            variant: "success",
+            noCloseButton: true,
+          });
+        });
       }
     },
 
git clone https://git.99rst.org/PROJECT