Skip to content

Commit

Permalink
check if session exists
Browse files Browse the repository at this point in the history
  • Loading branch information
younes200 committed Oct 10, 2023
1 parent c435856 commit 13df577
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/admin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const start = async () => {
});

const isAuthenticated = function (req, res, next) {
if (req.user.role == UserRole.Admin)
if (req.user && req.user.role == UserRole.Admin)
return next();
res.redirect('/')
}
Expand Down

0 comments on commit 13df577

Please sign in to comment.