Refactor ingredient mapping to exclude location and convert quantity to number
This commit is contained in:
@@ -86,7 +86,7 @@ export default function EditRecipePage() {
|
|||||||
// Konvertera quantity till number för varje ingrediens
|
// Konvertera quantity till number för varje ingrediens
|
||||||
const recipeToSend = {
|
const recipeToSend = {
|
||||||
...recipe,
|
...recipe,
|
||||||
ingredients: recipe.ingredients.map((ing) => ({
|
ingredients: recipe.ingredients.map(({ location: _loc, ...ing }) => ({
|
||||||
...ing,
|
...ing,
|
||||||
quantity: Number(ing.quantity),
|
quantity: Number(ing.quantity),
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export default function CreateRecipePage() {
|
|||||||
// Konvertera quantity till number för varje ingrediens
|
// Konvertera quantity till number för varje ingrediens
|
||||||
const recipeToSend = {
|
const recipeToSend = {
|
||||||
...recipe,
|
...recipe,
|
||||||
ingredients: recipe.ingredients.map((ing) => ({
|
ingredients: recipe.ingredients.map(({ location: _loc, ...ing }) => ({
|
||||||
...ing,
|
...ing,
|
||||||
quantity: Number(ing.quantity),
|
quantity: Number(ing.quantity),
|
||||||
})),
|
})),
|
||||||
|
|||||||
Reference in New Issue
Block a user