diff --git a/src/main.ts b/src/main.ts index 3c721df98..7833dd03b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -228,7 +228,6 @@ async function initApp() { } await loadUserPermissions(); - await loadActivatedTheme(); try { await loadPluginModules(); @@ -239,6 +238,10 @@ async function initApp() { // load system setup state const systemStateStore = useSystemStatesStore(); await systemStateStore.fetchSystemStates(); + + if (systemStateStore.states.isSetup) { + await loadActivatedTheme(); + } } catch (e) { console.error(e); } finally { diff --git a/src/stores/system-states.ts b/src/stores/system-states.ts index b3e61952d..8cada689e 100644 --- a/src/stores/system-states.ts +++ b/src/stores/system-states.ts @@ -1,5 +1,6 @@ -import { apiClient } from "@/utils/api-client"; import { defineStore } from "pinia"; +import axios from "axios"; +import type { ConfigMap } from "@halo-dev/api-client"; interface SystemState { isSetup: boolean; @@ -19,10 +20,14 @@ export const useSystemStatesStore = defineStore({ actions: { async fetchSystemStates() { try { - const { data } = - await apiClient.extension.configMap.getv1alpha1ConfigMap({ - name: "system-states", - }); + const { data } = await axios.get( + `${ + import.meta.env.VITE_API_URL + }/api/v1alpha1/configmaps/system-states`, + { + withCredentials: true, + } + ); if (data.data) { this.states = JSON.parse(data.data["states"]);