From b1390b5fec6a7bc69c1f4a455286afbbf25aeb46 Mon Sep 17 00:00:00 2001 From: Hayden Date: Sun, 3 Jan 2021 12:07:01 -0900 Subject: [PATCH] alert on bad url --- frontend/src/components/AddRecipe.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/AddRecipe.vue b/frontend/src/components/AddRecipe.vue index 301ccf9ca9fb..da53c0e0adeb 100644 --- a/frontend/src/components/AddRecipe.vue +++ b/frontend/src/components/AddRecipe.vue @@ -8,6 +8,11 @@ + + + Looks like there was an error parsing the URL. Check the log and + debug/last_recipe.json to see what went wrong. + @@ -37,6 +42,7 @@ import api from "../api"; export default { data() { return { + error: false, fab: false, addRecipe: false, recipeURL: "", @@ -47,9 +53,16 @@ export default { methods: { async createRecipe() { this.processing = true; - await api.recipes.createByURL(this.recipeURL); + let response = await api.recipes.createByURL(this.recipeURL); + if (response.status !== 201) { + this.error = true; + this.processing = false; + return; + } + this.addRecipe = false; this.processing = false; + this.$router.push(`/recipe/${response.data}`); }, navCreate() {