From 13df5779563bcd48d85481b5f574104dcc527b99 Mon Sep 17 00:00:00 2001 From: Younes Date: Tue, 10 Oct 2023 16:00:27 +0100 Subject: [PATCH] check if session exists --- apps/admin/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/admin/src/index.ts b/apps/admin/src/index.ts index 37fa109b..faad783b 100644 --- a/apps/admin/src/index.ts +++ b/apps/admin/src/index.ts @@ -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('/') }