Files
gridpilot.gg/apps/website/app/auth/layout.tsx
2026-01-03 02:42:47 +01:00

30 lines
846 B
TypeScript

import { headers } from 'next/headers';
import { createRouteGuard } from '@/lib/auth/createRouteGuard';
interface AuthLayoutProps {
children: React.ReactNode;
}
/**
* Auth Layout
*
* Provides authentication route protection for all auth routes.
* Uses RouteGuard to enforce access control server-side.
*
* Behavior:
* - Unauthenticated users can access auth pages (login, signup, etc.)
* - Authenticated users are redirected away from auth pages
*/
export default async function AuthLayout({ children }: AuthLayoutProps) {
const headerStore = await headers();
const pathname = headerStore.get('x-pathname') || '/';
const guard = createRouteGuard();
await guard.enforce({ pathname });
return (
<div className="min-h-screen bg-deep-graphite flex items-center justify-center p-4">
{children}
</div>
);
}