designtopack/src/stores/dialog.js

20 lines
520 B
JavaScript
Raw Normal View History

import { defineStore } from "pinia";
2024-11-16 12:05:37 +01:00
import { ref, computed } from "vue";
export const useDialogStore = defineStore("dialog", () => {
const content = ref(null);
2024-11-16 12:05:37 +01:00
const openedFile = ref(null);
const comments = computed(() => {
return openedFile.value.comments;
});
2024-11-16 12:05:37 +01:00
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 };
});