web: redirect if the user is not logged in based on session_id cookie's presence

This commit is contained in:
rhpidfyre 2025-03-26 16:16:38 -04:00
parent 636bb1fb94
commit 9a6baafa0a

@ -1,8 +1,18 @@
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import Header from "./header";
export default function Webpage({children}: Readonly<{children?: React.ReactNode}>) {
return (<>
<Header/>
{children}
</>)
export default async function Webpage({children}: Readonly<{children?: React.ReactNode}>) {
const cookieStore = await cookies()
const session_id = cookieStore.get("session_id")
if (!session_id) {
redirect("https://auth.staging.strafes.net/")
return <></>
}
return <>
<Header/>
{children}
</>
}