import { defineStore } from "pinia"; 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; }); 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 }; });