From 3b99a147fbfe088826b4a9c4004675db784f9c8d Mon Sep 17 00:00:00 2001 From: sephrat <34862846+sephrat@users.noreply.github.com> Date: Wed, 23 Jun 2021 19:45:16 +0200 Subject: [PATCH] Handle untitled note (#592) * Leave recipe in edit mode in case of an API error * Initialize recipe note with empty title Fixes #586 --- frontend/src/components/Recipe/Parts/Notes.vue | 2 +- frontend/src/components/Recipe/RecipePageActionMenu.vue | 1 - frontend/src/pages/Recipe/ViewRecipe.vue | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Recipe/Parts/Notes.vue b/frontend/src/components/Recipe/Parts/Notes.vue index 0c1eeb26955e..d5cf1f47825c 100644 --- a/frontend/src/components/Recipe/Parts/Notes.vue +++ b/frontend/src/components/Recipe/Parts/Notes.vue @@ -55,7 +55,7 @@ export default { return utils.generateUniqueKey(item, index); }, addNote() { - this.value.push({ text: "" }); + this.value.push({ title: "", text: "" }); }, removeByIndex(list, index) { list.splice(index, 1); diff --git a/frontend/src/components/Recipe/RecipePageActionMenu.vue b/frontend/src/components/Recipe/RecipePageActionMenu.vue index 92f68f84ed7d..df91e67c3ee9 100644 --- a/frontend/src/components/Recipe/RecipePageActionMenu.vue +++ b/frontend/src/components/Recipe/RecipePageActionMenu.vue @@ -134,7 +134,6 @@ export default { break; case SAVE_EVENT: this.$emit(SAVE_EVENT); - this.$emit("input", false); break; case JSON_EVENT: this.$emit(JSON_EVENT); diff --git a/frontend/src/pages/Recipe/ViewRecipe.vue b/frontend/src/pages/Recipe/ViewRecipe.vue index 73854b2ba51c..61cb699b5805 100644 --- a/frontend/src/pages/Recipe/ViewRecipe.vue +++ b/frontend/src/pages/Recipe/ViewRecipe.vue @@ -233,6 +233,7 @@ export default { async saveRecipe() { if (this.validateRecipe()) { let slug = await api.recipes.update(this.recipeDetails); + if(!slug) return; if (this.fileObject) { this.saveImage(true);