diff options
Diffstat (limited to 'pages/api/login.js')
-rw-r--r-- | pages/api/login.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pages/api/login.js b/pages/api/login.js index 5d5dd9c..1e9f816 100644 --- a/pages/api/login.js +++ b/pages/api/login.js @@ -10,7 +10,8 @@ export default withSession(async (req, res) => { switch (method) { case 'POST': try { - const { _id, email, isVerified, noteList, theme, language } = await User.findByCredentials(req.body.email, req.body.password) + const { email, password } = JSON.parse(req.body) + const { _id, isVerified, noteList, theme, language } = await User.findByCredentials(email, password) if (!email) { throw new Error('Something went wrong') } const user = { _id, email, isVerified, isLoggedIn: true, noteList, theme, language } |