Yaltopia-FIFA/app/(master)/layout.tsx
Kirubel-Kibru-Yaltopia 89440985f1
Some checks failed
Deploy to Cloudflare Workers / deploy (push) Has been cancelled
x
2026-05-24 21:46:10 +03:00

22 lines
639 B
TypeScript

import { redirect } from "next/navigation";
import { requirePortalRole } from "@/lib/auth/profile";
import { MasterShell } from "@/components/layout/MasterShell";
export default async function MasterLayout({
children,
}: {
children: React.ReactNode;
}) {
const gate = await requirePortalRole("league_master");
if (!gate.ok) {
redirect(gate.reason === "auth" ? "/login/master" : "/login/manager");
}
const user = {
name: gate.profile?.display_name ?? gate.user.email?.split("@")[0] ?? "Master",
email: gate.user.email ?? "",
};
return <MasterShell user={user}>{children}</MasterShell>;
}