Show ya ya saved recipes

This commit is contained in:
jableader 2024-09-22 12:58:25 +10:00
parent cc3f18ad70
commit e59d4aa0ed

View file

@ -64,6 +64,7 @@ input.recipe-name {
<script> <script>
import alert from '@/alert.js'
import data from '@/data.js' import data from '@/data.js'
import EditableIngredientsPanel from '@/components/ingredients/EditableIngredientsPanel.vue' import EditableIngredientsPanel from '@/components/ingredients/EditableIngredientsPanel.vue'
@ -121,11 +122,12 @@ export default {
async saveRecipe() { async saveRecipe() {
const recipe = await data.saveRecipe(this.recipe); const recipe = await data.saveRecipe(this.recipe);
if (recipe?.id >= 0) { if (recipe?.id >= 0) {
alert.show({ heading: 'Recipe saved', message: 'Your recipe has been saved', type: 'success' });
this.$router.push(`/recipes/${recipe.id}`); this.$router.push(`/recipes/${recipe.id}`);
return; return;
} }
alert('Failed to save recipe'); alert.show({ heading: 'Error saving recipe', message: 'There was an error saving your recipe', type: 'error' });
}, },
async createFromScratch() { async createFromScratch() {
this.recipe = { this.recipe = {