Trying To Manually Load Config

This commit is contained in:
Annika Merris 2024-03-02 10:11:05 -05:00
parent 7171757234
commit a4c98b1818

View file

@ -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<string, PowerItem>())
const intimacyPowerItems = ref(new Map<string, PowerItem>())
//#endregion
axiosRetry(axios, {
retries: 3,
retryDelay: axiosRetry.exponentialDelay