Move admin panel to /root and decouple it from locale routing
This commit is contained in:
+6
-2
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user