26 lines
668 B
TypeScript
26 lines
668 B
TypeScript
import { auth } from "@/auth";
|
|
import { redirect } from "next/navigation";
|
|
import { getDictionary, Locale } from "@/app/dictionaries";
|
|
import DashboardLayoutClient from "./DashboardLayoutClient";
|
|
|
|
export default async function DashboardLayout(
|
|
props: {
|
|
children: React.ReactNode;
|
|
params: Promise<{ lang: string }>;
|
|
}
|
|
) {
|
|
const params = await props.params;
|
|
const { children } = props;
|
|
|
|
const session = await auth();
|
|
if (!session) redirect(`/${params.lang}/login`);
|
|
|
|
const dict = await getDictionary(params.lang as Locale);
|
|
|
|
return (
|
|
<DashboardLayoutClient dict={dict} lang={params.lang}>
|
|
{children}
|
|
</DashboardLayoutClient>
|
|
);
|
|
}
|