diff --git a/src/main.ts b/src/main.ts index cba0e87c0..7fa378e0a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,6 +18,7 @@ import { hasPermission } from "@/utils/permission"; import { useRoleStore } from "@/stores/role"; import type { RouteRecordRaw } from "vue-router"; import { useThemeStore } from "./stores/theme"; +import { useSystemStatesStore } from "./stores/system-states"; const app = createApp(App); @@ -240,6 +241,9 @@ async function initApp() { } catch (e) { console.error("Failed to load plugins", e); } + + const systemStateStore = useSystemStatesStore(); + await systemStateStore.fetchSystemStates(); } catch (e) { console.error(e); } finally { diff --git a/src/router/guards/check-states.ts b/src/router/guards/check-states.ts index 10b7a3eb6..4f4ba3baa 100644 --- a/src/router/guards/check-states.ts +++ b/src/router/guards/check-states.ts @@ -10,8 +10,6 @@ export function setupCheckStatesGuard(router: Router) { const systemStateStore = useSystemStatesStore(); - await systemStateStore.fetchSystemStates(); - if (!systemStateStore.states.isSetup) { next({ name: "Setup" }); return; diff --git a/src/views/system/Setup.vue b/src/views/system/Setup.vue index 752fba1a9..4a18aef8b 100644 --- a/src/views/system/Setup.vue +++ b/src/views/system/Setup.vue @@ -92,6 +92,9 @@ const handleSubmit = async () => { }, }); + const systemStateStore = useSystemStatesStore(); + await systemStateStore.fetchSystemStates(); + router.push({ name: "Dashboard" }); } catch (error) { console.error("Failed to setup", error);