aboutsummaryrefslogtreecommitdiffstats
path: root/\
diff options
context:
space:
mode:
authorGravatar piotrruss <mail@pruss.it> 2021-08-09 21:58:41 +0200
committerGravatar piotrruss <mail@pruss.it> 2021-08-09 21:58:41 +0200
commitd43c93ab5e5abb9b2007c43422c4f4d0897e5eb4 (patch)
tree2c89825ae6f0e84a693bfe318f01327426baaba9 /\
parent2db5389d07a9d2e93ebe4998b18d0fecf3636513 (diff)
downloadmy_apps-d43c93ab5e5abb9b2007c43422c4f4d0897e5eb4.tar.gz
my_apps-d43c93ab5e5abb9b2007c43422c4f4d0897e5eb4.tar.bz2
my_apps-d43c93ab5e5abb9b2007c43422c4f4d0897e5eb4.zip
deploy fixes
Diffstat (limited to '\')
-rw-r--r--\23
1 files changed, 23 insertions, 0 deletions
diff --git a/\ b/\
new file mode 100644
index 0000000..59db3b6
--- /dev/null
+++ b/\
@@ -0,0 +1,23 @@
+import dbConnect from 'lib/dbConnect'
+import withSession from 'lib/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,
+ })
+ }
+})