Does has
in cookies
don't work in Route Handler?
#54005
Answered
by
devjiwonchoi
devjiwonchoi
asked this question in
App Router
-
Description
Console- error TypeError: (0 , next_headers__WEBPACK_IMPORTED_MODULE_1__.cookies)(...).has is not a function
at GET (webpack-internal:///(rsc)/./src/app/api/route.ts:11:78)
at ... Reproduction// route.ts
import { NextResponse } from 'next/server'
import { cookies } from 'next/headers'
export async function GET() {
const hasToken = cookies().has('token')
if (!hasToken) return NextResponse.json({ message: 'token is missing' })
return NextResponse.json({ message: 'token exists' })
} |
Beta Was this translation helpful? Give feedback.
Answered by
devjiwonchoi
Aug 16, 2023
Replies: 1 comment
Answer selected by
devjiwonchoi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Resolved with #54112
Released in v13.4.17