From 8dc7f0663dc28c3b81fdf5ba77bac7051c94930e Mon Sep 17 00:00:00 2001 From: Hayden Date: Mon, 4 Jan 2021 17:17:06 -0900 Subject: [PATCH] create new recipe without image --- frontend/src/components/NewRecipe.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/NewRecipe.vue b/frontend/src/components/NewRecipe.vue index 76fed90cac6d..da46271eed84 100644 --- a/frontend/src/components/NewRecipe.vue +++ b/frontend/src/components/NewRecipe.vue @@ -83,12 +83,19 @@ export default { onFileChange() { this.image = URL.createObjectURL(this.fileObject); }, + async createRecipe() { this.isLoading = true; - this.recipeDetails.image = this.fileObject.name; + + if (this.fileObject) { + this.recipeDetails.image = this.fileObject.name; + } let slug = await api.recipes.create(this.recipeDetails); - await api.recipes.updateImage(slug, this.fileObject); + if (this.fileObject) { + await api.recipes.updateImage(slug, this.fileObject); + } + this.isLoading = false; this.$router.push(`/recipe/${slug}`);