From aac64c2b068e937f939cdefed7af4f08bcb8b3eb Mon Sep 17 00:00:00 2001 From: piotrruss Date: Fri, 24 Sep 2021 22:51:34 +0200 Subject: send notes as plain/text --- pages/api/notes/[id].js | 2 +- pages/api/notes/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'pages') diff --git a/pages/api/notes/[id].js b/pages/api/notes/[id].js index a2cd680..5099f4f 100644 --- a/pages/api/notes/[id].js +++ b/pages/api/notes/[id].js @@ -54,7 +54,7 @@ export default withSession(async (req, res) => { try { const session = await conn.startSession() const user = req.session.get('user') - const { title, noteId, content } = req.body + const { title, noteId, content } = JSON.parse(req.body) if (!user || !user?.isVerified || !_id || !content) { throw new Error('Something went wrong') diff --git a/pages/api/notes/index.js b/pages/api/notes/index.js index 86369ed..2c53909 100644 --- a/pages/api/notes/index.js +++ b/pages/api/notes/index.js @@ -26,7 +26,7 @@ export default withSession(async (req, res) => { try { const session = await conn.startSession() const user = req.session.get('user') - const { title, content } = req.body + const { title, content } = JSON.parse(req.body) if (!user || !user?.isVerified || !content) { throw new Error('Something went wrong') -- cgit v1.2.3