Error: Route "/api/messages/[messageId]/feedbacks" used params.messageId. params should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis

at POST (app/api/messages/[messageId]/feedbacks/route.ts:12:11)
  10 |     rating,
  11 |   } = body
> 12 |   const { messageId } = params
     |           ^
  13 |   const { user } = getInfo(request)
  14 |   const { data } = await client.messageFeedback(messageId, rating, user)
  15 |   return NextResponse.json(data)
 POST /api/messages/36fd2d18-909b-4bb9-b46d-6e7f72a705e4/feedbacks 200 in 557ms
This commit is contained in:
Eric-Guo
2025-09-15 10:02:43 +08:00
committed by lyzno1
parent 0cb8fdcf15
commit 18a4229464

View File

@ -3,13 +3,13 @@ import { NextResponse } from 'next/server'
import { client, getInfo } from '@/app/api/utils/common'
export async function POST(request: NextRequest, { params }: {
params: { messageId: string }
params: Promise<{ messageId: string }>
}) {
const body = await request.json()
const {
rating,
} = body
const { messageId } = params
const { messageId } = await params
const { user } = getInfo(request)
const { data } = await client.messageFeedback(messageId, rating, user)
return NextResponse.json(data)