diff options
author | 2022-05-08 13:45:13 +0100 | |
---|---|---|
committer | 2022-05-08 13:45:13 +0100 | |
commit | 3bbc6402f8b43f14aa7974a9b3ef9a7ed67f27d9 (patch) | |
tree | dd5ad0cbbb49756053053d2c0f0c7897d6c021f2 /pages | |
parent | 5086e947a995004f8eaf79668493c57051550545 (diff) | |
download | my_apps-3bbc6402f8b43f14aa7974a9b3ef9a7ed67f27d9.tar.gz my_apps-3bbc6402f8b43f14aa7974a9b3ef9a7ed67f27d9.tar.bz2 my_apps-3bbc6402f8b43f14aa7974a9b3ef9a7ed67f27d9.zip |
allow req changing only title
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() |