new comment showing in comments panel

This commit is contained in:
isUnknown 2024-11-16 12:05:37 +01:00
parent 26369ad71b
commit 2c99811caf
5 changed files with 88 additions and 34 deletions

View file

@ -137,7 +137,6 @@ export const useApiStore = defineStore("api", () => {
} catch (error) {
console.error(
"Une erreur s'est produite lors de l'ajout du commentaire :",
commentaire,
error
);
throw error;

View file

@ -1,8 +1,19 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { ref, computed } from "vue";
export const useDialogStore = defineStore("dialog", () => {
const content = ref(null);
const openedFile = ref(null);
const comments = computed(() => {
return openedFile.value.comments;
});
return { content };
function updateFile(newFile) {
content.value.files = content.value.files.map((file) =>
file.id === newFile.id ? newFile : file
);
openedFile.value = newFile;
}
return { content, openedFile, comments, updateFile };
});