diff --git a/resources/js/router/index.js b/resources/js/router/index.js index 05ee913..41c62f2 100644 --- a/resources/js/router/index.js +++ b/resources/js/router/index.js @@ -452,6 +452,7 @@ router.beforeEach(async (to, from, next) => { const userStore = useUserStore(); const applicationStore = useApplicationStore(); + applicationStore.hydrated = false; applicationStore.clearDynamicTitle(); if (applicationStore.pageLoaderTimeout !== 0) { @@ -586,6 +587,9 @@ router.afterEach((to, from) => { if (pageLoadingElem !== null) { pageLoadingElem.style.display = "none"; } + + applicationStore.hydrated = true; + console.log("hydrated"); }); export default router; diff --git a/resources/js/store/ApplicationStore.ts b/resources/js/store/ApplicationStore.ts index f3f9aeb..15b5e2a 100644 --- a/resources/js/store/ApplicationStore.ts +++ b/resources/js/store/ApplicationStore.ts @@ -3,6 +3,7 @@ import { defineStore } from "pinia"; type ApplicationStoreEventKeyUpCallback = (event: KeyboardEvent) => boolean; export interface ApplicationStore { + hydrated: boolean; unavailable: boolean; dynamicTitle: string; eventKeyUpStack: ApplicationStoreEventKeyUpCallback[]; @@ -13,6 +14,7 @@ export interface ApplicationStore { export const useApplicationStore = defineStore({ id: "application", state: (): ApplicationStore => ({ + hydrated: false, unavailable: false, dynamicTitle: "", eventKeyUpStack: [], diff --git a/resources/js/views/App.vue b/resources/js/views/App.vue index 43010d0..afbc6af 100644 --- a/resources/js/views/App.vue +++ b/resources/js/views/App.vue @@ -1,8 +1,8 @@