Allow checkout pages to bypass maintenance mode

This commit is contained in:
Andymick
2026-07-18 10:23:57 +01:00
parent bda02c4add
commit ac777efc46
+5 -1
View File
@@ -34,8 +34,12 @@ export default async function RootLayout({ children }: { children: React.ReactNo
const pathname = headers().get('x-pathname') ?? ''; const pathname = headers().get('x-pathname') ?? '';
// Admins bypass maintenance (they can keep working); /admin/* is always // Admins bypass maintenance (they can keep working); /admin/* is always
// reachable so the owner can log in and toggle it back off. // 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 = const showMaintenance =
maintenanceMode && !pathname.startsWith('/admin') && !(await isAdminAuthenticated()); maintenanceMode &&
!pathname.startsWith('/admin') &&
!pathname.startsWith('/checkout') &&
!(await isAdminAuthenticated());
return ( return (
<html lang="en" suppressHydrationWarning className={`${fraunces.variable} ${inter.variable} ${mono.variable} ${caveat.variable}`}> <html lang="en" suppressHydrationWarning className={`${fraunces.variable} ${inter.variable} ${mono.variable} ${caveat.variable}`}>