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:
2026-08-18 16:10:35 +03:30
co-authored by Cursor
parent 5d3ca82236
commit a9d0cba909
7 changed files with 250 additions and 89 deletions
+10 -3
View File
@@ -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)