How do get query params from api route
Answered
Mallow bee posted this in #help-forum
Mallow beeOP
http://localhost:3000/api/user/verify?code=cllesytig0001gkzoiayp1ir4
How can i get the "code" query inside an api route
How can i get the "code" query inside an api route
6 Replies
@joulev https://discord.com/channels/752553802359505017/1127781032242974790/1127784013961121893
Mallow beeOP
Works but also get this wierd error:
URLSearchParams { 'code' => 'cllesytig0001gkzoiayp1ir4' }
- error TypeError: Cannot read properties of undefined (reading 'headers')
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/next@13.4.16_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/future/route-modules/app-route/module.js:266:61)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)@Mallow bee Works but also get this wierd error:
bash
URLSearchParams { 'code' => 'cllesytig0001gkzoiayp1ir4' }
- error TypeError: Cannot read properties of undefined (reading 'headers')
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/next@13.4.16_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/future/route-modules/app-route/module.js:266:61)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
that's because you didn't return a response in the handler
you have to return a
Response instance (or an extension of it e.g. a NextResponse)my code example didn't have it
Mallow beeOP
arrghh alr thank you