Files
web/app/[lang]/(live)/(protected)/layout.tsx

23 lines
517 B
TypeScript

import { auth, signIn } from "@/auth"
import type { LangParams, LayoutArgs } from "@/types/params"
export default async function ProtectedLayout({
children,
params,
}: React.PropsWithChildren<LayoutArgs<LangParams>>) {
const session = await auth()
/**
* Fallback to make sure every route nested in the
* protected route group is actually protected.
*/
if (!session) {
await signIn("curity", undefined, {
ui_locales: params.lang,
})
return null
}
return <>{children}</>
}