Fix bug when ingredients have no name

This commit is contained in:
harry 2023-10-18 21:46:07 +01:00
parent d09eb64a41
commit 43a55c8c82

View File

@ -1084,7 +1084,11 @@ export default {
this.$nextTick(() => document.getElementById(`amount_${this.recipe.steps.indexOf(step)}_${step.ingredients.length - 1}`).select()) this.$nextTick(() => document.getElementById(`amount_${this.recipe.steps.indexOf(step)}_${step.ingredients.length - 1}`).select())
}, },
removeIngredient: function (step, ingredient) { removeIngredient: function (step, ingredient) {
if (confirm(this.$t("delete_confirmation", {source: `"${ingredient.food.name}"`}))) { let message = this.$t("confirm_delete", {object: this.$t("Ingredient")})
if (ingredient.food?.name) {
message = this.$t("delete_confirmation", {source: `"${ingredient.food.name}"`})
}
if (confirm(message)) {
step.ingredients = step.ingredients.filter((item) => item !== ingredient) step.ingredients = step.ingredients.filter((item) => item !== ingredient)
} }
}, },