diff options
author | 2021-09-06 23:13:22 +0200 | |
---|---|---|
committer | 2021-09-06 23:13:22 +0200 | |
commit | 569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a (patch) | |
tree | 8d1cb94a56d60b9d726222277b7516fc59895613 /pages/api/login.js | |
parent | 275bd1d0a9aea90696c145cf992d522a0d6b0aa8 (diff) | |
download | my_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.tar.gz my_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.tar.bz2 my_apps-569bdb8c5d7538fa0ea8a99ff2f8376f7cbfa51a.zip |
added stadard linter
Diffstat (limited to 'pages/api/login.js')
-rw-r--r-- | pages/api/login.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/pages/api/login.js b/pages/api/login.js index 038097c..5d5dd9c 100644 --- a/pages/api/login.js +++ b/pages/api/login.js @@ -3,27 +3,26 @@ import dbConnect from 'configs/dbConnect' import User from 'models/User' export default withSession(async (req, res) => { - const {method} = req + const { method } = req await dbConnect() switch (method) { case 'POST': try { - const {_id, email, isVerified, noteList, theme, language} = await User.findByCredentials(req.body.email, req.body.password); + const { _id, email, isVerified, noteList, theme, language } = await User.findByCredentials(req.body.email, req.body.password) if (!email) { throw new Error('Something went wrong') } - const user = {_id, email, isVerified, isLoggedIn: true, noteList, theme, language} + const user = { _id, email, isVerified, isLoggedIn: true, noteList, theme, language } req.session.set('user', user) await req.session.save() res.status(201).json(user) } catch (error) { - res.status(400).json({isLoggedIn: false}) + res.status(400).json({ isLoggedIn: false }) } break default: - res.status(400).send({isLoggedIn: false}) + res.status(400).send({ isLoggedIn: false }) break } }) - |