mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 12:27:43 +00:00
docs: update getSessionCookie import in demo and docs (#1534)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import { getSessionCookie } from "better-auth";
|
import { getSessionCookie } from "better-auth/cookies";
|
||||||
|
|
||||||
export async function middleware(request: NextRequest) {
|
export async function middleware(request: NextRequest) {
|
||||||
const cookies = getSessionCookie(request);
|
const cookies = getSessionCookie(request);
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ You can use the `getSessionCookie` helper from Better Auth for this purpose:
|
|||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import { getSessionCookie } from "better-auth";
|
import { getSessionCookie } from "better-auth/cookies";
|
||||||
|
|
||||||
export async function middleware(request: NextRequest) {
|
export async function middleware(request: NextRequest) {
|
||||||
const sessionCookie = getSessionCookie(request); // Optionally pass config as the second argument if cookie name or prefix is customized.
|
const sessionCookie = getSessionCookie(request); // Optionally pass config as the second argument if cookie name or prefix is customized.
|
||||||
|
|||||||
Reference in New Issue
Block a user