Skip to content

Commit

Permalink
fix nextjs docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper committed Oct 16, 2024
1 parent ecabac3 commit e9ac7ae
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pages/sessions/cookies/nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function deleteSessionTokenCookie(): void {
cookies().set("session", "", {
httpOnly: true,
sameSite: "lax",
secure: import.meta.env.PROD,
secure: process.env.NODE_ENV === "production",
maxAge: 0,
path: "/"
});
Expand Down Expand Up @@ -124,10 +124,10 @@ Sessions can be validated by getting the cookie and using the `validateSessionTo
```ts
import { validateSessionToken } from "$lib/server/session";

import type { APIContext } from "astro";
import type { NextRequest } from "next/server";

export async function GET(context: APIContext): Promise<Response> {
const token = cookies().get("session")?.value ?? null;
export async function GET(request: NextRequest): Promise<Response> {
const token = request.cookies.get("session")?.value ?? null;
if (token === null) {
return new Response(null, {
status: 401
Expand Down

0 comments on commit e9ac7ae

Please sign in to comment.