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 { ManagerShell } from "@/components/layout/ManagerShell";
|
|
|
|
export default async function ManagerLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const gate = await requirePortalRole("manager");
|
|
if (!gate.ok) {
|
|
redirect(gate.reason === "auth" ? "/login/manager" : "/login/master");
|
|
}
|
|
|
|
const user = {
|
|
name: gate.profile?.display_name ?? gate.user.email?.split("@")[0] ?? "Manager",
|
|
email: gate.user.email ?? "",
|
|
};
|
|
|
|
return <ManagerShell user={user}>{children}</ManagerShell>;
|
|
}
|