fix price
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { ref } from 'vue'
|
||||
import { setCachedMainMetal } from '@/utils/metalLabels'
|
||||
|
||||
export function getConfigApp(key: string) {
|
||||
@@ -12,6 +13,9 @@ export function getConfigApp(key: string) {
|
||||
let storeModeFromSettings: boolean | null = null
|
||||
let settingsBootstrapped = false
|
||||
|
||||
/** reactive — برای فیلتر منوی «بنرها» در پیکربندی */
|
||||
export const bannerEnabledSetting = ref(false)
|
||||
|
||||
function isSwitchOn(value: string | undefined | null): boolean {
|
||||
const v = (value ?? '').trim().toLowerCase()
|
||||
return v === 'true' || v === '1' || v === 'yes'
|
||||
@@ -21,6 +25,15 @@ export function setStoreModeFromSettings(value: boolean): void {
|
||||
storeModeFromSettings = value
|
||||
}
|
||||
|
||||
export function setBannerEnabledFromSettings(value: boolean): void {
|
||||
bannerEnabledSetting.value = value
|
||||
}
|
||||
|
||||
export function applyBannerEnabledFromRows(rows: Array<{ key?: string; value?: string | null }>) {
|
||||
const row = rows.find((item) => item.key === 'banner_enabled')
|
||||
setBannerEnabledFromSettings(row ? isSwitchOn(row.value) : false)
|
||||
}
|
||||
|
||||
async function bootstrapSettingsFromApi(): Promise<void> {
|
||||
if (settingsBootstrapped) return
|
||||
|
||||
@@ -33,11 +46,13 @@ async function bootstrapSettingsFromApi(): Promise<void> {
|
||||
const mainWalletRow = list.find((item) => item.key === 'main_wallet_products')
|
||||
const mainMetalRow = list.find((item) => item.key === 'main_metal')
|
||||
storeModeFromSettings = isStoreRow ? isSwitchOn(isStoreRow.value) : false
|
||||
applyBannerEnabledFromRows(list)
|
||||
setCachedMainMetal(mainMetalRow?.value)
|
||||
const { setCachedMainWalletProductIds } = await import('@/components/mobile/utils/wallet')
|
||||
setCachedMainWalletProductIds(parseMainWalletProductIds(mainWalletRow?.value))
|
||||
} catch {
|
||||
storeModeFromSettings = false
|
||||
setBannerEnabledFromSettings(false)
|
||||
setCachedMainMetal(null)
|
||||
const { setCachedMainWalletProductIds } = await import('@/components/mobile/utils/wallet')
|
||||
setCachedMainWalletProductIds([])
|
||||
|
||||
Reference in New Issue
Block a user