diff --git a/frontend/app/kvitto/actions.ts b/frontend/app/kvitto/actions.ts index de880fbc..8dd54740 100644 --- a/frontend/app/kvitto/actions.ts +++ b/frontend/app/kvitto/actions.ts @@ -20,7 +20,13 @@ export async function createProductAction(name: string) { throw new Error(e.message ?? `HTTP ${res.status}`); } - return res.json(); + const product = await res.json(); + // Return only serializable fields (Dates can't be serialized across RSC boundary) + return { + id: product.id, + name: product.name, + canonicalName: product.canonicalName, + }; } export async function updateProductCategoryAction(productId: number, categoryId: number) { @@ -37,5 +43,12 @@ export async function updateProductCategoryAction(productId: number, categoryId: throw new Error(e.message ?? `HTTP ${res.status}`); } - return res.json(); + const product = await res.json(); + // Return only serializable fields + return { + id: product.id, + name: product.name, + canonicalName: product.canonicalName, + categoryId: product.categoryId, + }; }