From 5086e947a995004f8eaf79668493c57051550545 Mon Sep 17 00:00:00 2001 From: piotrruss Date: Sun, 8 May 2022 13:05:58 +0100 Subject: send req as plain text --- pages/api/login.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pages/api/login.js') 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 } -- cgit v1.2.3