From 899d7a2f9d405c5e586a96901b8d82a3481a1810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=BCller?= Date: Tue, 20 Oct 2015 12:50:37 +0200 Subject: [PATCH] dispose note from cache before update --- server.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server.js b/server.js index b2fd27e..e4cba55 100644 --- a/server.js +++ b/server.js @@ -59,12 +59,11 @@ app.post('/note', function (req, res) { return sendResponse(res, 400, "Signature mismatch"); if (action == "POST") storage.addNote(note, password).then(goToNote); - else - storage.updateNote(id, password, note).then(note => { - CACHE.del(note.id); - goToNote(note); - }, - error => sendResponse(res, 403, error.message)) + else { + CACHE.del(id); + storage.updateNote(id, password, note).then(goToNote, + error => sendResponse(res, 403, error.message)); + } }); app.get("/:year/:month/:day/:title", function (req, res) {