This commit is contained in:
isUnknown 2025-01-07 14:33:02 +01:00
parent 9c39e0b7a6
commit ebd464460c

View file

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