web: redirect if the user is not logged in based on session_id
cookie's presence
This commit is contained in:
parent
039309c75a
commit
d5d0e5ffc9
@ -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}
|
||||
</>
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user