From 3b0208b5b4c91cce89333bc47925517fa2869522 Mon Sep 17 00:00:00 2001 From: Nils-Johan Gynther Date: Sun, 19 Apr 2026 14:39:12 +0200 Subject: [PATCH] fix(api): correct parameter handling in PATCH request for product updates --- frontend/app/api/products/[id]/route.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/app/api/products/[id]/route.ts b/frontend/app/api/products/[id]/route.ts index 47bd1a9b..08ab4440 100644 --- a/frontend/app/api/products/[id]/route.ts +++ b/frontend/app/api/products/[id]/route.ts @@ -3,10 +3,11 @@ import { getAuthHeaders } from '../../../../lib/auth-headers'; const API_BASE = process.env.NEXT_PUBLIC_API_URL_INTERNAL || 'http://recipe-api:8080'; -export async function PATCH(req: NextRequest, { params }: { params: { id: string } }) { +export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { + const { id } = await params; const authHeaders = await getAuthHeaders(); const body = await req.json(); - const res = await fetch(`${API_BASE}/api/products/${params.id}`, { + const res = await fetch(`${API_BASE}/api/products/${id}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json', ...authHeaders }, body: JSON.stringify(body),