Merge pull request #1238 from lnbits/fix/cashu/wallet/duplicate_history
Cashu wallet: correctly update ui on token sending
This commit is contained in:
commit
0df81e5aaf
1 changed files with 13 additions and 11 deletions
|
|
@ -1731,7 +1731,7 @@ page_container %}
|
||||||
splits proofs so the user can keep firstProofs, send scndProofs.
|
splits proofs so the user can keep firstProofs, send scndProofs.
|
||||||
then sets scndProofs as reserved.
|
then sets scndProofs as reserved.
|
||||||
|
|
||||||
if invalidate, scndProofs (the one to send) are invalidated
|
if invalidate, scndProofs (the one to send) are invalidated
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
const spendableProofs = proofs.filter(p => !p.reserved)
|
const spendableProofs = proofs.filter(p => !p.reserved)
|
||||||
|
|
@ -1961,7 +1961,7 @@ page_container %}
|
||||||
|
|
||||||
// /check
|
// /check
|
||||||
|
|
||||||
checkProofsSpendable: async function (proofs) {
|
checkProofsSpendable: async function (proofs, update_history = false) {
|
||||||
/*
|
/*
|
||||||
checks with the mint whether an array of proofs is still
|
checks with the mint whether an array of proofs is still
|
||||||
spendable or already invalidated
|
spendable or already invalidated
|
||||||
|
|
@ -1984,15 +1984,17 @@ page_container %}
|
||||||
this.deleteProofs(spentProofs)
|
this.deleteProofs(spentProofs)
|
||||||
|
|
||||||
// update UI
|
// update UI
|
||||||
tokensBase64 = btoa(JSON.stringify(spentProofs))
|
if (update_history) {
|
||||||
|
tokensBase64 = btoa(JSON.stringify(spentProofs))
|
||||||
|
|
||||||
this.historyTokens.push({
|
this.historyTokens.push({
|
||||||
status: 'paid',
|
status: 'paid',
|
||||||
amount: -this.sumProofs(spentProofs),
|
amount: -this.sumProofs(spentProofs),
|
||||||
date: currentDateStr(),
|
date: currentDateStr(),
|
||||||
token: tokensBase64
|
token: tokensBase64
|
||||||
})
|
})
|
||||||
this.storehistoryTokens()
|
this.storehistoryTokens()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
@ -2450,7 +2452,7 @@ page_container %}
|
||||||
console.log('#### this.mintId', this.mintId)
|
console.log('#### this.mintId', this.mintId)
|
||||||
console.log('#### this.mintName', this.mintName)
|
console.log('#### this.mintName', this.mintName)
|
||||||
|
|
||||||
this.checkProofsSpendable(this.proofs)
|
this.checkProofsSpendable(this.proofs, true)
|
||||||
this.checkPendingInvoices()
|
this.checkPendingInvoices()
|
||||||
this.checkPendingTokens()
|
this.checkPendingTokens()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue