26 lines
700 B
TypeScript
26 lines
700 B
TypeScript
import { redirect } from "next/navigation";
|
|
|
|
import { DashboardSidebar } from "@/components/dashboard-sidebar";
|
|
import { getCurrentMockSession } from "@/lib/mock-session";
|
|
import { getDashboardRedirectPath } from "@/lib/route-guards";
|
|
|
|
export default async function DashboardLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const session = await getCurrentMockSession();
|
|
const redirectPath = getDashboardRedirectPath(session);
|
|
|
|
if (redirectPath || !session) {
|
|
redirect(redirectPath ?? "/");
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-dvh bg-background md:flex">
|
|
<DashboardSidebar session={session} />
|
|
<div className="min-w-0 flex-1">{children}</div>
|
|
</div>
|
|
);
|
|
}
|