mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-01-18 21:32:38 +01:00
fix: topup wallet was showing NaN (#2504)
* fix: topup wallet was showing NaN
This commit is contained in:
parent
7a6c3646fb
commit
35bb3cc94b
2
lnbits/static/bundle.min.js
vendored
2
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -145,7 +145,7 @@ window.LNbits = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
updateBalance: function (credit, wallet_id) {
|
updateBalance: function (credit, wallet_id) {
|
||||||
return LNbits.api.request('PUT', '/users/api/v1/topup/', null, {
|
return LNbits.api.request('PUT', '/users/api/v1/topup', null, {
|
||||||
amount: credit,
|
amount: credit,
|
||||||
id: wallet_id
|
id: wallet_id
|
||||||
})
|
})
|
||||||
|
@ -702,7 +702,14 @@ Vue.component('lnbits-update-balance', {
|
|||||||
LNbits.api
|
LNbits.api
|
||||||
.updateBalance(credit, this.wallet_id)
|
.updateBalance(credit, this.wallet_id)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.callback({value: res, wallet_id: this.wallet_id})
|
if (res.data.status !== 'Success') {
|
||||||
|
throw new Error(res.data)
|
||||||
|
}
|
||||||
|
this.callback({
|
||||||
|
success: true,
|
||||||
|
credit: parseInt(credit),
|
||||||
|
wallet_id: this.wallet_id
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.then(_ => {
|
.then(_ => {
|
||||||
credit = parseInt(credit)
|
credit = parseInt(credit)
|
||||||
|
@ -351,12 +351,14 @@ new Vue({
|
|||||||
console.log('export users')
|
console.log('export users')
|
||||||
},
|
},
|
||||||
topupCallback(res) {
|
topupCallback(res) {
|
||||||
this.wallets.forEach(wallet => {
|
if (res.success) {
|
||||||
if (res.wallet_id === wallet.id) {
|
this.wallets.forEach(wallet => {
|
||||||
wallet.balance_msat += res.value * 1000
|
if (res.wallet_id === wallet.id) {
|
||||||
}
|
wallet.balance_msat += res.credit * 1000
|
||||||
})
|
}
|
||||||
this.fetchUsers()
|
})
|
||||||
|
this.fetchUsers()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
topupWallet() {
|
topupWallet() {
|
||||||
LNbits.api
|
LNbits.api
|
||||||
|
@ -535,7 +535,9 @@ new Vue({
|
|||||||
.catch(e => console.error(e))
|
.catch(e => console.error(e))
|
||||||
},
|
},
|
||||||
updateBalanceCallback: function (res) {
|
updateBalanceCallback: function (res) {
|
||||||
this.balance += res.value
|
if (res.success && wallet.id === res.wallet_id) {
|
||||||
|
this.balance += res.credit
|
||||||
|
}
|
||||||
},
|
},
|
||||||
pasteToTextArea: function () {
|
pasteToTextArea: function () {
|
||||||
this.$refs.textArea.focus() // Set cursor to textarea
|
this.$refs.textArea.focus() // Set cursor to textarea
|
||||||
|
Loading…
Reference in New Issue
Block a user