aboutsummaryrefslogtreecommitdiffstats
path: root/pages/api/login.js
diff options
context:
space:
mode:
authorGravatar piotrruss <mail@pruss.it> 2022-05-08 13:05:58 +0100
committerGravatar piotrruss <mail@pruss.it> 2022-05-08 13:05:58 +0100
commit5086e947a995004f8eaf79668493c57051550545 (patch)
tree23f1881065ef8b533d10ac69421d2d54e605f334 /pages/api/login.js
parentef8d5215e8115ac47d058a667a93b27bc0887a7f (diff)
downloadmy_apps-5086e947a995004f8eaf79668493c57051550545.tar.gz
my_apps-5086e947a995004f8eaf79668493c57051550545.tar.bz2
my_apps-5086e947a995004f8eaf79668493c57051550545.zip
send req as plain text
Diffstat (limited to 'pages/api/login.js')
-rw-r--r--pages/api/login.js3
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 }