Some checks failed
Deploy to Cloudflare Workers / deploy (push) Has been cancelled
22 lines
639 B
TypeScript
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>;
|
|
}
|