1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00

Allow tags/categories/tools deletion (#1142)

* feat: allow tags/categories/tools deletion

* Use gray color for delete action
This commit is contained in:
Miroito 2022-04-20 20:09:23 +02:00 committed by GitHub
parent aff30adda6
commit 60682dba75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 267 additions and 7 deletions

View file

@ -1,6 +1,6 @@
<template>
<v-container>
<RecipeCategoryTagToolPage v-if="tools" :items="tools" item-type="tools" />
<RecipeCategoryTagToolPage v-if="tools" :items="tools" item-type="tools" @delete="removeTool" />
</v-container>
</template>
@ -8,6 +8,7 @@
import { defineComponent, useAsync } from "@nuxtjs/composition-api";
import RecipeCategoryTagToolPage from "~/components/Domain/Recipe/RecipeCategoryTagToolPage.vue";
import { useUserApi } from "~/composables/api";
import { useAsyncKey } from "~/composables/use-utils";
export default defineComponent({
components: {
@ -21,9 +22,22 @@ export default defineComponent({
if (data) {
return data;
}
});
}, useAsyncKey());
function removeTool(id: string) {
if (tools.value) {
for (let i = 0; i < tools.value.length; i++) {
if (tools.value[i].id === id) {
tools.value.splice(i, 1);
break;
}
}
}
}
return {
tools,
removeTool,
};
},
});