mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-29 10:10:00 +02:00
fix: refresh when both onchain and ln are present
This commit is contained in:
@ -328,7 +328,8 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkBalances: async function () {
|
checkBalances: async function () {
|
||||||
if (this.charge.hasStaleBalance) return
|
if (!this.charge.lnbitswallet && this.charge.hasOnchainStaleBalance)
|
||||||
|
return
|
||||||
try {
|
try {
|
||||||
const {data} = await LNbits.api.request(
|
const {data} = await LNbits.api.request(
|
||||||
'GET',
|
'GET',
|
||||||
@ -353,7 +354,7 @@
|
|||||||
address: this.charge.onchainaddress
|
address: this.charge.onchainaddress
|
||||||
})
|
})
|
||||||
const newBalance = utxos.reduce((t, u) => t + u.value, 0)
|
const newBalance = utxos.reduce((t, u) => t + u.value, 0)
|
||||||
this.charge.hasStaleBalance = this.charge.balance === newBalance
|
this.charge.hasOnchainStaleBalance = this.charge.balance === newBalance
|
||||||
|
|
||||||
this.pendingFunds = utxos
|
this.pendingFunds = utxos
|
||||||
.filter(u => !u.status.confirmed)
|
.filter(u => !u.status.confirmed)
|
||||||
@ -430,6 +431,7 @@
|
|||||||
created: async function () {
|
created: async function () {
|
||||||
if (this.charge.lnbitswallet) this.payInvoice()
|
if (this.charge.lnbitswallet) this.payInvoice()
|
||||||
else this.payOnchain()
|
else this.payOnchain()
|
||||||
|
|
||||||
await this.checkBalances()
|
await this.checkBalances()
|
||||||
|
|
||||||
if (!this.charge.paid) {
|
if (!this.charge.paid) {
|
||||||
|
Reference in New Issue
Block a user