From a743f832a20e934b9813d3d4e199019ebc4566f8 Mon Sep 17 00:00:00 2001 From: Nils-Johan Gynther Date: Fri, 10 Apr 2026 18:31:48 +0200 Subject: [PATCH] Refactor ingredient mapping to exclude location and convert quantity to number --- frontend/app/recipes/[id]/edit/page.tsx | 2 +- frontend/app/recipes/create/CreateRecipePage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/app/recipes/[id]/edit/page.tsx b/frontend/app/recipes/[id]/edit/page.tsx index 226482ed..d4f6c466 100644 --- a/frontend/app/recipes/[id]/edit/page.tsx +++ b/frontend/app/recipes/[id]/edit/page.tsx @@ -86,7 +86,7 @@ export default function EditRecipePage() { // Konvertera quantity till number för varje ingrediens const recipeToSend = { ...recipe, - ingredients: recipe.ingredients.map((ing) => ({ + ingredients: recipe.ingredients.map(({ location: _loc, ...ing }) => ({ ...ing, quantity: Number(ing.quantity), })), diff --git a/frontend/app/recipes/create/CreateRecipePage.tsx b/frontend/app/recipes/create/CreateRecipePage.tsx index 9d25fedb..9d767e9f 100644 --- a/frontend/app/recipes/create/CreateRecipePage.tsx +++ b/frontend/app/recipes/create/CreateRecipePage.tsx @@ -51,7 +51,7 @@ export default function CreateRecipePage() { // Konvertera quantity till number för varje ingrediens const recipeToSend = { ...recipe, - ingredients: recipe.ingredients.map((ing) => ({ + ingredients: recipe.ingredients.map(({ location: _loc, ...ing }) => ({ ...ing, quantity: Number(ing.quantity), })),