diff options
Diffstat (limited to 'pages')
-rw-r--r-- | pages/api/notes/[id].js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pages/api/notes/[id].js b/pages/api/notes/[id].js index 5099f4f..275a0cf 100644 --- a/pages/api/notes/[id].js +++ b/pages/api/notes/[id].js @@ -56,12 +56,15 @@ export default withSession(async (req, res) => { const user = req.session.get('user') const { title, noteId, content } = JSON.parse(req.body) - if (!user || !user?.isVerified || !_id || !content) { + if (!user || !user?.isVerified || !_id) { throw new Error('Something went wrong') } await session.withTransaction(async () => { - await Note.updateNote(noteId, content) + if (content) { + await Note.updateNote(noteId, content) + } + const { notes } = await NoteList.updateList(user.noteList, noteId, title) session.endSession() |