aboutsummaryrefslogtreecommitdiffstats
path: root/pages/api/notes/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'pages/api/notes/index.js')
-rw-r--r--pages/api/notes/index.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/pages/api/notes/index.js b/pages/api/notes/index.js
index f62f849..16cb88c 100644
--- a/pages/api/notes/index.js
+++ b/pages/api/notes/index.js
@@ -15,7 +15,7 @@ export default withSession(async (req, res) => {
throw new Error('Something went wrong')
}
- const {notes} = await NoteList.getList(user.noteList)
+ const { notes } = await NoteList.getList(user.noteList)
res.status(200).json(notes)
} catch (error) {
@@ -25,14 +25,14 @@ export default withSession(async (req, res) => {
case 'POST':
try {
const user = req.session.get('user')
- const {title, content} = req.body
+ const { title, content } = req.body
if (!user || !user?.isVerified || !content) {
throw new Error('Something went wrong')
}
- const note = await Note.create({content})
- const {notes} = await NoteList.addNote(user.noteList, note._id, title)
+ const note = await Note.create({ content })
+ const { notes } = await NoteList.addNote(user.noteList, note._id, title)
res.status(200).json(notes)
} catch (error) {
@@ -44,5 +44,3 @@ export default withSession(async (req, res) => {
break
}
})
-
-