feat: load program-settings from SuperAdmin with 3-host failover
Use /api/public/program-settings only and retry montzar/montech/montest three rounds before showing the bootstrap error. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { computed, ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { getSettings } from '@/api/configuration'
|
||||
import { fetchSuperAdminProgramSettings } from '@/api/superadminSettings'
|
||||
import { resolveMeltedGoldLabel, resolveMetalTypeLabel } from '@/utils/metalLabels'
|
||||
import { resolveTradeWeightUnit } from '@/utils/weightUnit'
|
||||
|
||||
@@ -65,9 +66,15 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
|
||||
fetchPromise = (async () => {
|
||||
try {
|
||||
const data = await getSettings()
|
||||
if (Array.isArray(data)) {
|
||||
mergeSettings(data)
|
||||
const [local, remote] = await Promise.all([
|
||||
getSettings().catch(() => []),
|
||||
fetchSuperAdminProgramSettings(),
|
||||
])
|
||||
if (Array.isArray(local)) {
|
||||
mergeSettings(local)
|
||||
}
|
||||
if (remote.length) {
|
||||
mergeSettings(remote as AppSetting[])
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
||||
Reference in New Issue
Block a user