Files
cozsweet-frontend-nextjs/src/app/characters/[characterSlug]/private-zone/layout.tsx
T

24 lines
674 B
TypeScript

import type { ReactNode } from "react";
import { notFound } from "next/navigation";
import { getCharacterBySlug } from "@/data/constants/character";
import { PrivateZoneRouteProvider } from "@/providers/private-zone-route-provider";
export default async function CharacterPrivateZoneLayout({
children,
params,
}: {
children: ReactNode;
params: Promise<{ characterSlug: string }>;
}) {
const { characterSlug } = await params;
const character = getCharacterBySlug(characterSlug);
if (!character?.capabilities.privateZone) notFound();
return (
<PrivateZoneRouteProvider characterId={character.id}>
{children}
</PrivateZoneRouteProvider>
);
}