Update payments on invoice creation (#1782)

* update payments on invoice creation
* remove unnecessary payment polling
This commit is contained in:
jackstar12
2023-08-18 12:10:52 +02:00
committed by GitHub
parent 8a6e411a0d
commit 642f9a4c00
2 changed files with 2 additions and 21 deletions

View File

@@ -313,7 +313,6 @@ new Vue({
this.receive.data.amount = null this.receive.data.amount = null
this.receive.data.memo = null this.receive.data.memo = null
this.receive.unit = 'sat' this.receive.unit = 'sat'
this.receive.paymentChecker = null
this.receive.minMax = [0, 2100000000000000] this.receive.minMax = [0, 2100000000000000]
this.receive.lnurl = null this.receive.lnurl = null
this.focusInput('setAmount') this.focusInput('setAmount')
@@ -357,11 +356,6 @@ new Vue({
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
}) })
}, },
closeReceiveDialog: function () {
setTimeout(() => {
clearInterval(this.receive.paymentChecker)
}, 10000)
},
closeParseDialog: function () { closeParseDialog: function () {
setTimeout(() => { setTimeout(() => {
clearInterval(this.parse.paymentChecker) clearInterval(this.parse.paymentChecker)
@@ -374,7 +368,6 @@ new Vue({
if (this.receive.paymentHash === paymentHash) { if (this.receive.paymentHash === paymentHash) {
this.receive.show = false this.receive.show = false
this.receive.paymentHash = null this.receive.paymentHash = null
clearInterval(this.receive.paymentChecker)
} }
}, },
createInvoice: function () { createInvoice: function () {
@@ -419,19 +412,7 @@ new Vue({
} }
} }
clearInterval(this.receive.paymentChecker) this.fetchPayments()
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)
}) })
.catch(err => { .catch(err => {
LNbits.utils.notifyApiError(err) LNbits.utils.notifyApiError(err)

View File

@@ -428,7 +428,7 @@
</div> </div>
</div> </div>
<q-dialog v-model="receive.show" @hide="closeReceiveDialog"> <q-dialog v-model="receive.show">
{% raw %} {% raw %}
<q-card <q-card
v-if="!receive.paymentReq" v-if="!receive.paymentReq"