feat: add remove functionality to tag view, add confirm alert

This commit is contained in:
Christoph Kluge 2025-04-23 15:01:12 +02:00
parent 543ddf540e
commit 1b3a12a4dc

View File

@ -46,13 +46,11 @@
};
function removeTag(tag, tagType) {
if (confirm("Are you sure you want to completely remove this tag?\n\n" + tagType + ':' + tag.name)) {
pendingChange = tagType;
removeTagMutation({tagIds: [tag.id] }).subscribe(
(res) => {
if (res.fetching === false && !res.error) {
// console.log('Removed:', res.data.removeTagFromList)
// console.log('Targets:', tagType, tagmap[tagType])
// console.log('Filter:', tagmap[tagType].filter((t) => !res.data.removeTagFromList.includes(t.id)))
tagmap[tagType] = tagmap[tagType].filter((t) => !res.data.removeTagFromList.includes(t.id));
if (tagmap[tagType].length === 0) {
delete tagmap[tagType]
@ -64,6 +62,7 @@
},
);
}
}
</script>
<div class="container">