From 5944c1461481437a9a3b2f0cb1a4f47b36d12791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=B6rdle=20Bot?= Date: Sun, 23 Nov 2025 00:53:36 +0100 Subject: [PATCH] fix(api): await params in Next.js 15 dynamic routes --- app/api/specials/[id]/route.ts | 10 ++++++---- app/api/specials/[id]/songs/route.ts | 15 +++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/api/specials/[id]/route.ts b/app/api/specials/[id]/route.ts index 8b1fcb8..41383fd 100644 --- a/app/api/specials/[id]/route.ts +++ b/app/api/specials/[id]/route.ts @@ -5,10 +5,11 @@ const prisma = new PrismaClient(); export async function GET( request: Request, - { params }: { params: { id: string } } + { params }: { params: Promise<{ id: string }> } ) { try { - const specialId = parseInt(params.id); + const { id } = await params; + const specialId = parseInt(id); const special = await prisma.special.findUnique({ where: { id: specialId }, @@ -37,10 +38,11 @@ export async function GET( export async function PUT( request: Request, - { params }: { params: { id: string } } + { params }: { params: Promise<{ id: string }> } ) { try { - const specialId = parseInt(params.id); + const { id } = await params; + const specialId = parseInt(id); const { name, maxAttempts, unlockSteps } = await request.json(); const special = await prisma.special.update({ diff --git a/app/api/specials/[id]/songs/route.ts b/app/api/specials/[id]/songs/route.ts index 4f40e9d..3d941b6 100644 --- a/app/api/specials/[id]/songs/route.ts +++ b/app/api/specials/[id]/songs/route.ts @@ -5,10 +5,11 @@ const prisma = new PrismaClient(); export async function POST( request: Request, - { params }: { params: { id: string } } + { params }: { params: Promise<{ id: string }> } ) { try { - const specialId = parseInt(params.id); + const { id } = await params; + const specialId = parseInt(id); const { songId, startTime = 0, order } = await request.json(); const specialSong = await prisma.specialSong.create({ @@ -32,10 +33,11 @@ export async function POST( export async function PUT( request: Request, - { params }: { params: { id: string } } + { params }: { params: Promise<{ id: string }> } ) { try { - const specialId = parseInt(params.id); + const { id } = await params; + const specialId = parseInt(id); const { songId, startTime, order } = await request.json(); const specialSong = await prisma.specialSong.update({ @@ -63,10 +65,11 @@ export async function PUT( export async function DELETE( request: Request, - { params }: { params: { id: string } } + { params }: { params: Promise<{ id: string }> } ) { try { - const specialId = parseInt(params.id); + const { id } = await params; + const specialId = parseInt(id); const { songId } = await request.json(); await prisma.specialSong.delete({