diff --git a/src/stores/powerItems.ts b/src/stores/powerItems.ts index 01cd9af..e6f2cdf 100644 --- a/src/stores/powerItems.ts +++ b/src/stores/powerItems.ts @@ -5,6 +5,8 @@ import { computed, ref, toRaw } from 'vue' import axiosRetry from 'axios-retry' import { apiBaseURL as apiBaseURLKey } from '@/types/ConfigSymbols' import { inject } from 'vue' +import { getConfig } from '@/services/siteConfig' +import type { Config } from '@/types/Config' const BLESSING = 1 const INTIMACY = 2 @@ -24,7 +26,14 @@ export const usePowerItems = defineStore('powerItems', () => { const BLESSING_POWER_ITEM_STORAGE = 'BLESSING_POWER_ITEM_STORAGE' const FELLOW_POWER_ITEM_STORAGE = 'FELLOW_POWER_ITEM_STORAGE' const INTIMACY_POWER_ITEM_STORAGE = 'INTIMACY_POWER_ITEM_STORAGE' - const apiBaseURL = inject(apiBaseURLKey)! + let apiBaseURL = inject(apiBaseURLKey)! + if (apiBaseURL === undefined) { + getConfig().then((conf: Config | null) => { + if (conf !== null) { + apiBaseURL = conf.apiBaseURL + } + }) + } console.log(apiBaseURL) //#endregion @@ -33,7 +42,7 @@ export const usePowerItems = defineStore('powerItems', () => { const fellowPowerItems = ref(new Map()) const intimacyPowerItems = ref(new Map()) //#endregion - + axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay