21 lines
473 B
TypeScript
21 lines
473 B
TypeScript
export const dynamic = 'force-dynamic'
|
|
|
|
import { redirect } from 'next/navigation'
|
|
import { getSession } from '@/lib/auth/get-session'
|
|
import { AppShell } from '@/components/layout/app-shell'
|
|
|
|
export default async function ProtectedLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) {
|
|
const session = await getSession()
|
|
if (!session) redirect('/login')
|
|
|
|
return (
|
|
<AppShell role={session.role} userName={session.name}>
|
|
{children}
|
|
</AppShell>
|
|
)
|
|
}
|