export const dynamic = "force-dynamic"; import DashboardHeader from "@/components/dashboard/dashboard-header"; import DashboardSidebar from "@/components/dashboard/dashboard-sidebar"; import { SidebarProvider } from "@/components/ui/sidebar"; import { getSession, } from "@/features/auth/services/auth.service"; import { sidebar } from "@/lib/constant/dashboard"; import { redirect } from "next/navigation"; type Role = keyof typeof sidebar; export default async function layout({ children, }: { children: React.ReactNode; }) { const user = await getSession(); if (!user) { redirect("/login"); } const role = user?.role as Role | undefined; return (
{role && }
{children}
); }