From 27b4db9877d22b8889d95cccb2097b1f5576c74e Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Mon, 25 Jul 2022 11:52:28 +0100 Subject: [PATCH] fix older tpos without tips (#778) --- lnbits/extensions/tpos/templates/tpos/tpos.html | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lnbits/extensions/tpos/templates/tpos/tpos.html b/lnbits/extensions/tpos/templates/tpos/tpos.html index cfda22c02..e11f60797 100644 --- a/lnbits/extensions/tpos/templates/tpos/tpos.html +++ b/lnbits/extensions/tpos/templates/tpos/tpos.html @@ -169,7 +169,9 @@
{% raw %}{{ fsat }} sat - ( + {{ tipAmountSat }} tip) + ( + {{ tipAmountSat }} tip) {% endraw %}
@@ -275,7 +277,7 @@ return { tposId: '{{ tpos.id }}', currency: '{{ tpos.currency }}', - tip_options: JSON.parse('{{ tpos.tip_options }}'), + tip_options: null, exchangeRate: null, stack: [], tipAmount: 0.0, @@ -352,7 +354,7 @@ this.showInvoice() }, submitForm: function () { - if (this.tip_options.length) { + if (this.tip_options) { this.showTipModal() } else { this.showInvoice() @@ -417,6 +419,11 @@ created: function () { var getRates = this.getRates getRates() + this.tip_options = + '{{ tpos.tip_options | tojson }}' == 'null' + ? null + : JSON.parse('{{ tpos.tip_options }}') + console.log(typeof this.tip_options, this.tip_options) setInterval(function () { getRates() }, 20000)