feat: reduce initial requests on wallet page (#2335)

* feat: reduce initial request on wallet page
- refactor allowed_currencies into function to use in generic and api.
- remove currencies request in frontend move it to generic
- dont request balance on first payments fetch
This commit is contained in:
dni ⚡
2024-03-22 12:59:49 +01:00
committed by GitHub
parent 5b022e2ef3
commit 299228b7b5
5 changed files with 24 additions and 21 deletions
+6 -11
View File
@@ -818,8 +818,10 @@ new Vue({
}
},
watch: {
payments: function () {
this.fetchBalance()
payments: function (_, oldVal) {
if (oldVal && oldVal.length !== 0) {
this.fetchBalance()
}
},
'paymentsChart.group': function () {
this.showChart()
@@ -837,18 +839,11 @@ new Vue({
this.mobileSimple = true
}
this.fetchPayments()
this.balance = Math.floor(window.wallet.balance_msat / 1000)
this.update.name = this.g.wallet.name
this.update.currency = this.g.wallet.currency
LNbits.api
.request('GET', '/api/v1/currencies')
.then(response => {
this.receive.units = ['sat', ...response.data]
})
.catch(err => {
LNbits.utils.notifyApiError(err)
})
this.receive.units = ['sat', ...window.currencies]
},
mounted: function () {
// show disclaimer