Skip to content

Commit 48c4748

Browse files
committed
fix: update protected routes handler to allow custom admin routes
1 parent 405acb4 commit 48c4748

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/authentication/protected-routes.handler.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ export const withProtectedRoutesHandler = (
2525
return next();
2626
}
2727

28-
if (isAdminRoute(req.originalUrl, rootPath) && !!req.session.adminUser) {
29-
return next();
28+
if (isAdminRoute(req.originalUrl, rootPath)) {
29+
if (!!req.session.adminUser) {
30+
return next();
31+
}
32+
return res.redirect(loginPath);
3033
}
3134

32-
return res.redirect(loginPath);
35+
return next(); // custom routes in admin router
3336
});
3437
};
3538

0 commit comments

Comments
 (0)