From a4c98b18184c1f6cd70bf0ebf468ff482b5d389c Mon Sep 17 00:00:00 2001 From: Annika Merris Date: Sat, 2 Mar 2024 10:11:05 -0500 Subject: [PATCH] Trying To Manually Load Config --- src/stores/powerItems.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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