import type { ReactNode } from "react"; import type { LayoutProps } from '@/core/types/common'; import { auth } from "@/auth"; import { permanentRedirect } from "next/navigation"; import { getInitialServerPathname } from "@/core/utils/helpers/cookies"; import AdminPanel from "@/core/common/AdminPanel"; export const dynamic = "force-dynamic"; /** * Profile layout. It's specifics to authorized users to manage their account & personal data.\ * * @param {LayoutProps & ParallelSlots<"sidebar">} props common {@link LayoutProps} props object containing `children` * and the extended {@link ParallelSlots} to allow the parallel * slots in the layout segment. * @return {Promise} * @constructor */ export default async function Layout({ children }: LayoutProps): Promise { const pathname = await getInitialServerPathname(); const session = await auth(); if (!session) { return permanentRedirect("/auth/sign-in"); } return (
{children}
); }