Created
November 21, 2022 20:13
-
-
Save ChristianOConnor/a44adc4d98c807ba63d09392ca8824bb to your computer and use it in GitHub Desktop.
cookies() won't work on Next.js 13 with turbopack 112122
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { cookies } from 'next/headers'; | |
async function GetSpecCookies() { | |
console.log('GetLitCookies is running'); | |
const cookiesList = cookies(); | |
const hasCookie = cookiesList.has('lit-auth') | |
return hasCookie | |
} | |
export default async function Page() { | |
const authorized = await GetSpecCookies(); | |
console.log('page function got cookies'); | |
return ( | |
<div className="space-y-4"> | |
<div className="text-xl font-medium text-zinc-500"> | |
Instant Loading States | |
</div> | |
<div className="space-y-4"> | |
Hi | |
</div> | |
<div> | |
<a | |
className="font-medium text-zinc-300 hover:text-white" | |
href="https://beta.nextjs.org/docs/routing/loading-ui" | |
> | |
Learn more | |
</a> | |
</div> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment