24 lines
796 B
TypeScript
24 lines
796 B
TypeScript
import { notFound, redirect } from "next/navigation";
|
|
import { ProductPlanningPage } from "@/components/product-planning/product-planning-page";
|
|
import { isProductPlanningEnabled } from "@/lib/product-planning/server-feature";
|
|
import { getProductPlanningPageToken } from "@/lib/product-planning/page-auth";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function ProductPlanningRoute() {
|
|
const enabled = await isProductPlanningEnabled();
|
|
if (!enabled) {
|
|
notFound();
|
|
}
|
|
|
|
const token = await getProductPlanningPageToken();
|
|
if (!token?.sub) {
|
|
redirect("/login");
|
|
}
|
|
|
|
const type = String(token.type || "").trim();
|
|
const canManageTemplates = type === "admin" || type === "agent_admin";
|
|
|
|
return <ProductPlanningPage canManageTemplates={canManageTemplates} />;
|
|
}
|