blob: 58c9ea2c6e80c835e19d7662257d7e20646f5824 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import dbConnect from 'configs/dbConnect'
import withSession from 'hocs/withSession'
import User from 'models/User'
export default withSession(async (req, res) => {
await dbConnect()
const user = req.session.get('user')
if (user) {
const state = await User.state(user._id)
res.json({
isLoggedIn: true,
...user,
...state
})
} else {
res.json({
isLoggedIn: false
})
}
})
|