From 642f9a4c00ed38d21a9a22f573fa923b5bfb5561 Mon Sep 17 00:00:00 2001 From: jackstar12 <62219658+jackstar12@users.noreply.github.com> Date: Fri, 18 Aug 2023 12:10:52 +0200 Subject: [PATCH] Update payments on invoice creation (#1782) * update payments on invoice creation * remove unnecessary payment polling --- lnbits/core/static/js/wallet.js | 21 +-------------------- lnbits/core/templates/core/wallet.html | 2 +- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/lnbits/core/static/js/wallet.js b/lnbits/core/static/js/wallet.js index 4b8993dba..485450550 100644 --- a/lnbits/core/static/js/wallet.js +++ b/lnbits/core/static/js/wallet.js @@ -313,7 +313,6 @@ new Vue({ this.receive.data.amount = null this.receive.data.memo = null this.receive.unit = 'sat' - this.receive.paymentChecker = null this.receive.minMax = [0, 2100000000000000] this.receive.lnurl = null this.focusInput('setAmount') @@ -357,11 +356,6 @@ new Vue({ LNbits.utils.notifyApiError(error) }) }, - closeReceiveDialog: function () { - setTimeout(() => { - clearInterval(this.receive.paymentChecker) - }, 10000) - }, closeParseDialog: function () { setTimeout(() => { clearInterval(this.parse.paymentChecker) @@ -374,7 +368,6 @@ new Vue({ if (this.receive.paymentHash === paymentHash) { this.receive.show = false this.receive.paymentHash = null - clearInterval(this.receive.paymentChecker) } }, createInvoice: function () { @@ -419,19 +412,7 @@ new Vue({ } } - clearInterval(this.receive.paymentChecker) - setTimeout(() => { - clearInterval(this.receive.paymentChecker) - }, 40000) - this.receive.paymentChecker = setInterval(() => { - let hash = response.data.payment_hash - - LNbits.api.getPayment(this.g.wallet, hash).then(response => { - if (response.data.paid) { - this.onPaymentReceived(hash) - } - }) - }, 5000) + this.fetchPayments() }) .catch(err => { LNbits.utils.notifyApiError(err) diff --git a/lnbits/core/templates/core/wallet.html b/lnbits/core/templates/core/wallet.html index fd4a9dee9..50befc17e 100644 --- a/lnbits/core/templates/core/wallet.html +++ b/lnbits/core/templates/core/wallet.html @@ -428,7 +428,7 @@ - + {% raw %}