Files
edubox/server/app/dashboard/layout.tsx
T
2026-06-06 19:55:41 +00:00

19 lines
615 B
TypeScript

import { getServerSession } from "next-auth/next";
import { authOptions } from "@/lib/auth-config";
import { redirect } from "next/navigation";
import DashboardNav from "./DashboardNav";
export const dynamic = "force-dynamic";
export default async function DashboardLayout({ children }: { children: React.ReactNode }) {
const session = await getServerSession(authOptions);
if (!session?.user) redirect("/login");
return (
<div className="flex min-h-screen bg-gray-50">
<DashboardNav role={session.user.role} />
<main className="flex-1 p-6 overflow-auto">{children}</main>
</div>
);
}