fix: respect admin-configured allowed currencies in dropdowns
Use window.g.allowedCurrencies instead of fetching all currencies from the API, so currency dropdowns only show currencies configured by the admin in LNbits settings. Closes #116 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
17d13dbe6b
commit
697fc1260d
2 changed files with 9 additions and 28 deletions
|
|
@ -162,22 +162,13 @@ window.app.component('shipping-zones', {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getCurrencies() {
|
getCurrencies() {
|
||||||
try {
|
const currencies = window.g.allowedCurrencies || []
|
||||||
const {data} = await LNbits.api.request(
|
this.currencies = ['sat', ...currencies]
|
||||||
'GET',
|
|
||||||
'/nostrmarket/api/v1/currencies',
|
|
||||||
this.inkey
|
|
||||||
)
|
|
||||||
|
|
||||||
this.currencies = ['sat', ...data]
|
|
||||||
} catch (error) {
|
|
||||||
LNbits.utils.notifyApiError(error)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: async function () {
|
created: async function () {
|
||||||
await this.getZones()
|
await this.getZones()
|
||||||
await this.getCurrencies()
|
this.getCurrencies()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -149,19 +149,9 @@ window.app.component('stall-list', {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCurrencies: async function () {
|
getCurrencies: function () {
|
||||||
try {
|
const currencies = window.g.allowedCurrencies || []
|
||||||
const {data} = await LNbits.api.request(
|
return ['sat', ...currencies]
|
||||||
'GET',
|
|
||||||
'/nostrmarket/api/v1/currencies',
|
|
||||||
this.inkey
|
|
||||||
)
|
|
||||||
|
|
||||||
return ['sat', ...data]
|
|
||||||
} catch (error) {
|
|
||||||
LNbits.utils.notifyApiError(error)
|
|
||||||
}
|
|
||||||
return []
|
|
||||||
},
|
},
|
||||||
getStalls: async function (pending = false) {
|
getStalls: async function (pending = false) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -207,7 +197,7 @@ window.app.component('stall-list', {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openCreateStallDialog: async function (stallData) {
|
openCreateStallDialog: async function (stallData) {
|
||||||
this.currencies = await this.getCurrencies()
|
this.currencies = this.getCurrencies()
|
||||||
this.zoneOptions = await this.getZones()
|
this.zoneOptions = await this.getZones()
|
||||||
if (!this.zoneOptions || !this.zoneOptions.length) {
|
if (!this.zoneOptions || !this.zoneOptions.length) {
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
|
|
@ -256,7 +246,7 @@ window.app.component('stall-list', {
|
||||||
},
|
},
|
||||||
created: async function () {
|
created: async function () {
|
||||||
this.stalls = await this.getStalls()
|
this.stalls = await this.getStalls()
|
||||||
this.currencies = await this.getCurrencies()
|
this.currencies = this.getCurrencies()
|
||||||
this.zoneOptions = await this.getZones()
|
this.zoneOptions = await this.getZones()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue