From bcd22d4e76b797163cda812731112760e6586251 Mon Sep 17 00:00:00 2001 From: John Corser Date: Mon, 6 Jan 2025 12:37:09 -0500 Subject: [PATCH] feat: add delete option to three dots menu --- frontend/components/Domain/Recipe/RecipeActionMenu.vue | 2 +- frontend/components/Domain/Recipe/RecipeContextMenu.vue | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/components/Domain/Recipe/RecipeActionMenu.vue b/frontend/components/Domain/Recipe/RecipeActionMenu.vue index 6822d830b75..6de10c9eed6 100644 --- a/frontend/components/Domain/Recipe/RecipeActionMenu.vue +++ b/frontend/components/Domain/Recipe/RecipeActionMenu.vue @@ -47,7 +47,6 @@ :recipe-id="recipe.id" :recipe-scale="recipeScale" :use-items="{ - delete: false, edit: false, download: loggedIn, duplicate: loggedIn, @@ -57,6 +56,7 @@ printPreferences: true, share: loggedIn, recipeActions: true, + delete: loggedIn, }" class="ml-1" @print="$emit('print')" diff --git a/frontend/components/Domain/Recipe/RecipeContextMenu.vue b/frontend/components/Domain/Recipe/RecipeContextMenu.vue index b54189251b3..a0a47832c58 100644 --- a/frontend/components/Domain/Recipe/RecipeContextMenu.vue +++ b/frontend/components/Domain/Recipe/RecipeContextMenu.vue @@ -276,7 +276,7 @@ export default defineComponent({ delete: { title: i18n.tc("general.delete"), icon: $globals.icons.delete, - color: "error", + color: undefined, event: "delete", isPublic: false, }, @@ -383,7 +383,10 @@ export default defineComponent({ } async function deleteRecipe() { - await api.recipes.deleteOne(props.slug); + const { data } = await api.recipes.deleteOne(props.slug); + if (data?.slug) { + router.push(`/g/${groupSlug.value}`); + } context.emit("delete", props.slug); }