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"); }