Error in api route
Answered
Blanc de Hotot posted this in #help-forum
Blanc de HototOP
src/app/api/invoices/[id]/route.ts
Type error: Route "src/app/api/invoices/[id]/route.ts" has an invalid "POST" export:
Type "{ params: { id: string; }; }" is not a valid type for the function's second argument.
Next.js build worker exited with code: 1 and signal: null
hiki@Qerwq:~/web_apps/billbo$
Type error: Route "src/app/api/invoices/[id]/route.ts" has an invalid "POST" export:
Type "{ params: { id: string; }; }" is not a valid type for the function's second argument.
Next.js build worker exited with code: 1 and signal: null
hiki@Qerwq:~/web_apps/billbo$
export async function POST(req: NextRequest, context: { params: { id: string } }) {}
Answered by Blanc de Hotot
export async function POST(
req: Request,
{ params }: { params: Promise<{ id: string }> }
) {}
2 Replies
Blanc de HototOP
nvm, solved
Blanc de HototOP
export async function POST(
req: Request,
{ params }: { params: Promise<{ id: string }> }
) {}
Answer