Redirect user if they're not logged into auth #28
web
@ -3,7 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3000",
|
||||
"dev": "next dev -p 3000 --turbopack",
|
||||
"build": "next build",
|
||||
"start": "next start -p 3000",
|
||||
"lint": "next lint"
|
||||
|
@ -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