From 09a9a0f9ecd04c7bb9beb8f2aecc5fbdc1bc1d94 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Thu, 7 Jul 2022 11:06:41 +0300 Subject: [PATCH] refactor: remove extra state fields --- .../satspay/templates/satspay/display.html | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/lnbits/extensions/satspay/templates/satspay/display.html b/lnbits/extensions/satspay/templates/satspay/display.html index 680e5fbe1..514bf453b 100644 --- a/lnbits/extensions/satspay/templates/satspay/display.html +++ b/lnbits/extensions/satspay/templates/satspay/display.html @@ -18,7 +18,7 @@ class="col" color="white" style="background-color: grey; height: 30px; padding: 5px" - v-else-if="charge_paid == 'True'" + v-else-if="charge.paid" >
Charge paid
@@ -46,10 +46,10 @@ {% raw %} Total to pay: {{ charge_amount }}sats
- Amount paid: {{ charge_balance }}
{% raw %} Total to pay: {{ charge.amount }}sats
+ Amount paid: {{ charge.balance }}
- Amount due: {{ charge_amount - charge_balance }}sats {% endraw %} + Amount due: {{ charge.amount - charge.balance }}sats {% endraw %}
@@ -59,7 +59,7 @@ @@ -81,7 +81,7 @@ @@ -106,13 +106,13 @@
-
+
-
+
-
+
-
+
= self.charge_amount) { - self.charge_paid = 'True' + + this.charge.time_elapsed = data.time_elapsed + this.charge.amount = data.amount + this.charge.balance = data.balance + if (this.charge.balance >= this.charge.amount) { + this.charge.paid = true } - }) - .catch(function (error) { - LNbits.utils.notifyApiError(error) - }) + } catch (error) { + LNbits.utils.notifyApiError(error) + } + + + }, payLN: function () { this.lnbtc = true @@ -304,7 +302,7 @@ timerCount: function () { self = this var refreshIntervalId = setInterval(function () { - if (self.charge_paid == 'True' || self.timetoComplete < 1) { + if (self.charge.paid|| self.timetoComplete < 1) { clearInterval(refreshIntervalId) } self.getTheTime() @@ -327,7 +325,7 @@ this.getTheTime() this.getThePercentage() var timerCount = this.timerCount - if ('{{ charge.paid }}' == 'False') { + if (!this.charge.paid) { timerCount() } this.startPaymentNotifier()