From f140b19e56fff05fa1ab4e73691cc03e7328b818 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Fri, 4 Nov 2022 18:46:26 +0200 Subject: [PATCH] fix: ugly method to refresh UI --- .../cashu/templates/cashu/wallet.html | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/lnbits/extensions/cashu/templates/cashu/wallet.html b/lnbits/extensions/cashu/templates/cashu/wallet.html index efd3ded38..e771cf9ca 100644 --- a/lnbits/extensions/cashu/templates/cashu/wallet.html +++ b/lnbits/extensions/cashu/templates/cashu/wallet.html @@ -22,7 +22,7 @@ page_container %}

- {% raw %} {{balance}} + {% raw %} {{getBalance()}} {{tickershort}}{% endraw %}

@@ -81,7 +81,7 @@ page_container %} t) + .flat() + .reduce((sum, el) => (sum += el.amount), 0) + }, + getTokenList: function () { + const x = this.proofs + .map(t => t.amount) + .reduce((acc, amount) => { + acc[amount] = acc[amount] + amount || 1 + return acc + }, {}) + return Object.keys(x).map(k => ({ + value: k, + count: x[k], + sum: k * x[k] + })) + }, + paymentTableRowKey: function (row) { return row.payment_hash + row.amount }, @@ -1269,7 +1289,7 @@ page_container %} if (!proofs.length) { throw 'could not mint' } - this.proofs.push(...proofs) + this.proofs = this.proofs.concat(proofs) this.storeProofs() await this.setInvoicePaid(payment_hash) return proofs @@ -1398,8 +1418,7 @@ page_container %} const usedSecrets = proofs.map(p => p.secret) this.proofs = this.proofs.filter(p => !usedSecrets.includes(p.secret)) // add new fristProofs, scndProofs to this.proofs - this.proofs.push(...fristProofs) - this.proofs.push(...scndProofs) + this.proofs = this.proofs.concat(fristProofs).concat(scndProofs) this.storeProofs() return {fristProofs, scndProofs} } catch (error) {