Move admin panel to /root and decouple it from locale routing

This commit is contained in:
MOH
2026-03-06 15:15:53 +01:00
parent 96a0d7f8bb
commit d070c32a85
6 changed files with 332 additions and 327 deletions
+6 -2
View File
@@ -115,10 +115,10 @@ export default async function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
const locale = getLocaleFromPath(pathname);
const isSuperAdmin = await isSuperAdminSessionValid(request);
const isRootBaseRoute = pathname === "/root" || pathname.startsWith("/root/");
const isRootRoute =
pathname === "/root" ||
pathname.startsWith("/root/") ||
isRootBaseRoute ||
pathname === `/${locale}/root` ||
pathname.startsWith(`/${locale}/root/`);
const isComingSoonRoute =
@@ -136,6 +136,10 @@ export default async function middleware(request: NextRequest) {
});
}
if (isRootBaseRoute) {
return NextResponse.next();
}
if (!isRootRoute && !isComingSoonRoute && !isSuperAdmin) {
const maintenanceModeEnabled = await isMaintenanceModeEnabled(request);