Allow checkout pages to bypass maintenance mode
This commit is contained in:
+5
-1
@@ -34,8 +34,12 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
const pathname = headers().get('x-pathname') ?? '';
|
||||
// Admins bypass maintenance (they can keep working); /admin/* is always
|
||||
// reachable so the owner can log in and toggle it back off.
|
||||
// Also allow /checkout/* pages so customers can complete purchases and see results.
|
||||
const showMaintenance =
|
||||
maintenanceMode && !pathname.startsWith('/admin') && !(await isAdminAuthenticated());
|
||||
maintenanceMode &&
|
||||
!pathname.startsWith('/admin') &&
|
||||
!pathname.startsWith('/checkout') &&
|
||||
!(await isAdminAuthenticated());
|
||||
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning className={`${fraunces.variable} ${inter.variable} ${mono.variable} ${caveat.variable}`}>
|
||||
|
||||
Reference in New Issue
Block a user