Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
25 lines
814 B
Plaintext
25 lines
814 B
Plaintext
import { getRouteWithoutAdmin } from './getRouteWithoutAdmin.js';
|
|
// Routes that require admin authentication
|
|
const publicAdminRoutes = ['createFirstUser', 'forgot', 'login', 'logout', 'forgot', 'inactivity', 'unauthorized', 'reset'];
|
|
export const isPublicAdminRoute = ({
|
|
adminRoute,
|
|
config,
|
|
route
|
|
}) => {
|
|
const isPublicAdminRoute = publicAdminRoutes.some(routeSegment => {
|
|
const segment = config.admin?.routes?.[routeSegment] || routeSegment;
|
|
const routeWithoutAdmin = getRouteWithoutAdmin({
|
|
adminRoute,
|
|
route
|
|
});
|
|
if (routeWithoutAdmin.startsWith(segment)) {
|
|
return true;
|
|
} else if (routeWithoutAdmin.includes('/verify/')) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
});
|
|
return isPublicAdminRoute;
|
|
};
|
|
//# sourceMappingURL=isPublicAdminRoute.js.map |