Apply maintenance mode to all non-admin routes
This commit is contained in:
+1
-2
@@ -114,7 +114,6 @@ async function isSuperAdminSessionValid(request: NextRequest): Promise<boolean>
|
|||||||
export default async function middleware(request: NextRequest) {
|
export default async function middleware(request: NextRequest) {
|
||||||
const { pathname } = request.nextUrl;
|
const { pathname } = request.nextUrl;
|
||||||
const locale = getLocaleFromPath(pathname);
|
const locale = getLocaleFromPath(pathname);
|
||||||
const isSuperAdmin = await isSuperAdminSessionValid(request);
|
|
||||||
const isRootBaseRoute = pathname === "/root" || pathname.startsWith("/root/");
|
const isRootBaseRoute = pathname === "/root" || pathname.startsWith("/root/");
|
||||||
|
|
||||||
const isRootRoute = isRootBaseRoute;
|
const isRootRoute = isRootBaseRoute;
|
||||||
@@ -137,7 +136,7 @@ export default async function middleware(request: NextRequest) {
|
|||||||
return NextResponse.next();
|
return NextResponse.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isRootRoute && !isComingSoonRoute && !isSuperAdmin) {
|
if (!isRootRoute && !isComingSoonRoute) {
|
||||||
const maintenanceModeEnabled = await isMaintenanceModeEnabled(request);
|
const maintenanceModeEnabled = await isMaintenanceModeEnabled(request);
|
||||||
|
|
||||||
if (maintenanceModeEnabled) {
|
if (maintenanceModeEnabled) {
|
||||||
|
|||||||
Reference in New Issue
Block a user