aboutsummaryrefslogtreecommitdiffstats
path: root/pages/api/note
diff options
context:
space:
mode:
Diffstat (limited to 'pages/api/note')
-rw-r--r--pages/api/note/[id].js5
1 files changed, 3 insertions, 2 deletions
diff --git a/pages/api/note/[id].js b/pages/api/note/[id].js
index 8ba3b70..46278c8 100644
--- a/pages/api/note/[id].js
+++ b/pages/api/note/[id].js
@@ -3,7 +3,7 @@ import withSession from 'lib/withSession'
import Note from 'models/Note'
export default withSession(async (req, res) => {
- const { id } = req.query
+ const {id} = req.query
await dbConnect()
switch (req.method) {
@@ -15,7 +15,7 @@ export default withSession(async (req, res) => {
throw new Error('Something went wrong')
}
- const note = await Note.findById(id)
+ const note = await Note.getNote(id)
if (!note) {
throw new Error('Something went wrong')
@@ -23,6 +23,7 @@ export default withSession(async (req, res) => {
res.status(200).json(note)
} catch (error) {
+ console.log(error)
res.status(400).json({error: true})
}
break