mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-09 21:07:46 +00:00
Merge pull request #1365 from hefler/doc-1364-next.js-ssr-auth-demo-add-await-to-code
doc: Added `await` to cookies().get() promise
This commit is contained in:
@@ -20,7 +20,7 @@ export async function createSessionClient() {
|
|||||||
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT)
|
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT)
|
||||||
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT);
|
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT);
|
||||||
|
|
||||||
const session = cookies().get("my-custom-session");
|
const session = await cookies().get("my-custom-session");
|
||||||
if (!session || !session.value) {
|
if (!session || !session.value) {
|
||||||
throw new Error("No session");
|
throw new Error("No session");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user