clean routes
This commit is contained in:
30
apps/website/app/auth/layout.tsx
Normal file
30
apps/website/app/auth/layout.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user