feat(admin): overlay system settings from SuperAdmin program-settings
Fetch /api/public/program-settings with 3-host retry and hide the local advanced-configuration editor in favor of SuperAdmin. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+17
-2
@@ -332,9 +332,24 @@ async function bootstrapSettingsFromApi(): Promise<void> {
|
||||
|
||||
try {
|
||||
const { getConfiguration } = await import('@/api/configuration')
|
||||
const { fetchSuperAdminProgramSettings } = await import('@/api/superadminSettings')
|
||||
const { parseMainWalletProductIds } = await import('@/components/mobile/utils/wallet')
|
||||
const rows = await getConfiguration()
|
||||
const list = Array.isArray(rows) ? rows : []
|
||||
const [localRows, saRows] = await Promise.all([
|
||||
getConfiguration().catch(() => []),
|
||||
fetchSuperAdminProgramSettings(),
|
||||
])
|
||||
const local = Array.isArray(localRows) ? localRows : []
|
||||
const merged = [...local]
|
||||
for (const item of saRows) {
|
||||
if (!item?.key) continue
|
||||
const index = merged.findIndex((row) => row.key === item.key)
|
||||
if (index >= 0) {
|
||||
merged[index] = { ...merged[index], ...item }
|
||||
} else {
|
||||
merged.push(item as (typeof merged)[number])
|
||||
}
|
||||
}
|
||||
const list = merged
|
||||
const isStoreRow = list.find((item) => item.key === 'is_store')
|
||||
const mainWalletRow = list.find((item) => item.key === 'main_wallet_products')
|
||||
const mainMetalRow = list.find((item) => item.key === 'main_metal')
|
||||
|
||||
Reference in New Issue
Block a user