diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 55586e9..8edd9e5 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -321,6 +321,7 @@ "ExtractPublicPropTypes": true, "WritableComputedRef": true, "injectLocal": true, + "storeRouteMapping": true, "provideLocal": true } } diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 7d89347..f254fea 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -115,6 +115,7 @@ declare global { const shallowReactive: typeof import('vue')['shallowReactive'] const shallowReadonly: typeof import('vue')['shallowReadonly'] const shallowRef: typeof import('vue')['shallowRef'] + const storeRouteMapping: typeof import('./src/utils/storeRouteMapping')['default'] const storeToRefs: typeof import('pinia')['storeToRefs'] const suite: typeof import('vitest')['suite'] const syncRef: typeof import('@vueuse/core')['syncRef'] diff --git a/src/App.vue b/src/App.vue index 6c9c8fd..dd4ce29 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,7 +2,11 @@ import { useSettings } from '@stores/useSettings' import ModalBox from '@components/ModalBox.vue' import { updateAuthKey } from '@/api' +import useStoreMapping from '@/utils/storeRouteMapping' +const routesToExclude = ['home', 'settings'] +const route = useRoute() +const { storeMapping } = useStoreMapping() const settings = useSettings() const { getStatus } = settings const { isReadyAndAuth } = storeToRefs(settings) @@ -23,6 +27,17 @@ const authenticate = async () => { //resetAllStores() } } + +const currentComponentLoading = computed(() => { + const routeName = route.name?.toString() + let store + if (routeName !== undefined && !routesToExclude.includes(routeName)) { + store = storeMapping[routeName] + const { currentState } = storeToRefs(store) + return store && currentState.value.loading + } + return false +}) diff --git a/src/components/ModalBox.vue b/src/components/ModalBox.vue index ba272fb..bc7e24d 100644 --- a/src/components/ModalBox.vue +++ b/src/components/ModalBox.vue @@ -25,6 +25,7 @@ const closeModal = () => { defineExpose({ toggleModal, isOpen, + closeModal, }) diff --git a/src/components/SidePanel.vue b/src/components/SidePanel.vue index de3fd80..41cfd21 100644 --- a/src/components/SidePanel.vue +++ b/src/components/SidePanel.vue @@ -1,6 +1,7 @@