mirror of
https://github.com/BradNut/weddingsite
synced 2025-09-08 17:40:36 +00:00
18 lines
442 B
JavaScript
18 lines
442 B
JavaScript
import withSession from '../../lib/session';
|
|
|
|
export default withSession(async (req, res) => {
|
|
const user = req.session.get('user');
|
|
|
|
if (user) {
|
|
// in a real world application you might read the user id from the session and then do a database request
|
|
// to get more information on the user if needed
|
|
res.json({
|
|
isLoggedIn: true,
|
|
...user,
|
|
});
|
|
} else {
|
|
res.json({
|
|
isLoggedIn: false,
|
|
});
|
|
}
|
|
});
|