23 lines
639 B
TypeScript
23 lines
639 B
TypeScript
import MainLayout from "@/components/layout/MainLayout";
|
|
import { cookies } from "next/headers";
|
|
import { redirect } from "next/navigation";
|
|
import {CookieKeys} from "@/store/cookie/cookie-keys";
|
|
|
|
export default async function MainLayoutWrapper({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
const cookieStore = await cookies();
|
|
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value;
|
|
|
|
if (!accessToken) {
|
|
redirect("/logout");
|
|
}
|
|
|
|
return (
|
|
<MainLayout>
|
|
{children}
|
|
</MainLayout>
|
|
);
|
|
} |