fix(api): correct parameter handling in PATCH request for product updates

This commit is contained in:
Nils-Johan Gynther
2026-04-19 14:39:12 +02:00
parent 632d084dbe
commit 3b0208b5b4
+3 -2
View File
@@ -3,10 +3,11 @@ import { getAuthHeaders } from '../../../../lib/auth-headers';
const API_BASE = process.env.NEXT_PUBLIC_API_URL_INTERNAL || 'http://recipe-api:8080'; 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 authHeaders = await getAuthHeaders();
const body = await req.json(); 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', method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...authHeaders }, headers: { 'Content-Type': 'application/json', ...authHeaders },
body: JSON.stringify(body), body: JSON.stringify(body),