fix(api): correct parameter handling in PATCH request for product updates
This commit is contained in:
@@ -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),
|
||||||
|
|||||||
Reference in New Issue
Block a user