|
|
@ -29,6 +29,7 @@ export class RecipeService {
|
|
|
|
recipes = recipes.filter((recipe) => recipe.id !== recipeId);
|
|
|
|
recipes = recipes.filter((recipe) => recipe.id !== recipeId);
|
|
|
|
localStorage.setItem(this.localStorageKey, JSON.stringify(recipes));
|
|
|
|
localStorage.setItem(this.localStorageKey, JSON.stringify(recipes));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Supprimer les IngredientRecipe associés
|
|
|
|
let ingredientRecipes = this.getIngredientRecipes(recipeId);
|
|
|
|
let ingredientRecipes = this.getIngredientRecipes(recipeId);
|
|
|
|
ingredientRecipes = ingredientRecipes.filter(
|
|
|
|
ingredientRecipes = ingredientRecipes.filter(
|
|
|
|
(ir) => ir.idRecipe !== recipeId
|
|
|
|
(ir) => ir.idRecipe !== recipeId
|
|
|
@ -37,6 +38,14 @@ export class RecipeService {
|
|
|
|
this.ingredientRecipeKey,
|
|
|
|
this.ingredientRecipeKey,
|
|
|
|
JSON.stringify(ingredientRecipes)
|
|
|
|
JSON.stringify(ingredientRecipes)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mettre à jour les commandes en cours
|
|
|
|
|
|
|
|
let currentOrders = this.getCurrentOrders();
|
|
|
|
|
|
|
|
currentOrders = currentOrders.filter((order) => order.id !== recipeId);
|
|
|
|
|
|
|
|
localStorage.setItem(
|
|
|
|
|
|
|
|
this.currentOrdersKey,
|
|
|
|
|
|
|
|
JSON.stringify(currentOrders)
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|