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