silverwolf-x's picture
download
raw
508 Bytes
import { cookies } from 'next/headers'
import { Redirect } from './redirect'
async function isLoggedIn() {
// sleep for 1s
await new Promise((resolve) => setTimeout(resolve, 1000))
const cookieData = await cookies()
const hasSession = !!cookieData.get('logged-in')
return hasSession
}
export default async function Layout({ children }) {
const loggedIn = await isLoggedIn()
console.log({ loggedIn })
if (!loggedIn) return <Redirect />
return <div>Protected Layout: {children}</div>
}

Xet Storage Details

Size:
508 Bytes
·
Xet hash:
9a06b3bc1edd710b00f607f134a00ea60ed4d85b644aa93bfd816503dbb82f2f

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.