Preview: protected-routes.handler.js
Size: 372 B
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/@adminjs/express/lib/authentication/protected-routes.handler.js
export const withProtectedRoutesHandler = (router, admin) => {
const { loginPath } = admin.options;
const authorizedRoutesMiddleware = (request, response, next) => {
if (!request.session || !request.session.adminUser) {
return response.redirect(loginPath);
}
return next();
};
router.use(authorizedRoutesMiddleware);
};
Directory Contents
Dirs: 0 × Files: 8