From a066ae6c39fc513323deb31ffa4322710264437e Mon Sep 17 00:00:00 2001 From: Kloon ImKloon Date: Sun, 10 Sep 2023 11:35:45 +0200 Subject: [PATCH] Fix watch warnings in Files.vue --- frontend/src/views/Files.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/Files.vue b/frontend/src/views/Files.vue index 2d91e962..9698aa54 100644 --- a/frontend/src/views/Files.vue +++ b/frontend/src/views/Files.vue @@ -34,6 +34,7 @@ import { watch, } from "vue"; import { files as api } from "@/api"; +import { storeToRefs } from "pinia"; import { useFileStore } from "@/stores/file"; import { useLayoutStore } from "@/stores/layout"; import { useUploadStore } from "@/stores/upload"; @@ -51,6 +52,9 @@ const layoutStore = useLayoutStore(); const fileStore = useFileStore(); const uploadStore = useUploadStore(); +const { reload } = storeToRefs(fileStore); +const { error: uploadError } = storeToRefs(uploadStore); + const route = useRoute(); const { t } = useI18n({}); @@ -98,14 +102,11 @@ onUnmounted(() => { }); watch(route, () => fetchData()); -// @ts-ignore -watch(fileStore.reload, (val) => { - if (val) { - fetchData(); - } +watch(reload, (newValue) => { + newValue && fetchData(); }); -watch(uploadStore.error, (newValue, oldValue) => { - newValue && newValue !== oldValue && layoutStore.showError(); +watch(uploadError, (newValue) => { + newValue && layoutStore.showError(); }); // Define functions