feat: complete MVP foundation auth and dashboard
This commit is contained in:
25
app/dashboard/layout.tsx
Normal file
25
app/dashboard/layout.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user