Files
gridpilot.gg/apps/website/app/profile/layout.tsx
2026-01-14 02:02:24 +01:00

23 lines
715 B
TypeScript

import type { ReactNode } from 'react';
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';
import ProfileLayoutShell from '@/components/profile/ProfileLayoutShell';
import { createRouteGuard } from '@/lib/auth/createRouteGuard';
interface ProfileLayoutProps {
children: ReactNode;
}
export default async function ProfileLayout({ children }: ProfileLayoutProps) {
const headerStore = await headers();
const pathname = headerStore.get('x-pathname') || '/';
const guard = createRouteGuard();
const result = await guard.enforce({ pathname });
if (result.type === 'redirect') {
redirect(result.to);
}
return <ProfileLayoutShell>{children}</ProfileLayoutShell>;
}