From ebd464460c7948c87459725984eff41e26f72027 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Tue, 7 Jan 2025 14:33:02 +0100 Subject: [PATCH] #85 --- src/components/comments/Comment.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/comments/Comment.vue b/src/components/comments/Comment.vue index a62960f..2255f54 100644 --- a/src/components/comments/Comment.vue +++ b/src/components/comments/Comment.vue @@ -55,6 +55,7 @@ import { useUserStore } from "../../stores/user"; import { useApiStore } from "../../stores/api"; import { useDialogStore } from "../../stores/dialog"; import { computed } from "vue"; +import { storeToRefs } from "pinia"; dayjs.locale("fr"); @@ -68,6 +69,7 @@ const emits = defineEmits(["update:file", "close:comment"]); const userStore = useUserStore(); const api = useApiStore(); const dialog = useDialogStore(); +const { activeTracks } = storeToRefs(useDialogStore()); // Functions const getStatus = computed(() => { @@ -113,9 +115,16 @@ async function read() { async function deleteComment(event) { event.stopPropagation(); - console.log(comment); const newFile = await api.deleteComment(comment); - dialog.updateFile(newFile); + console.log(newFile); + if (activeTracks.value.length > 0) { + activeTracks.value[0].files = activeTracks.value[0].files.map((file) => { + if (file.uuid !== newFile.uuid) return file; + return newFile; + }); + } else { + dialog.updateFile(newFile); + } if (comment.type === "comment-reply") { emits("close:comment"); }