30 lines
691 B
TypeScript
30 lines
691 B
TypeScript
import { getServerSession } from "next-auth";
|
|
import { authOptions } from "./api/auth/[...nextauth]/route";
|
|
import { redirect } from "next/navigation";
|
|
import { Providers } from "@/components/providers";
|
|
import { LayoutWrapper } from "@/components/layout/layout-wrapper";
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const session = await getServerSession(authOptions);
|
|
|
|
if (!session) {
|
|
redirect("/signin");
|
|
}
|
|
|
|
return (
|
|
<html lang="fr" suppressHydrationWarning>
|
|
<body>
|
|
<Providers>
|
|
<LayoutWrapper>
|
|
{children}
|
|
</LayoutWrapper>
|
|
</Providers>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|