block button

This commit is contained in:
callebtc
2022-11-05 23:12:25 +01:00
parent b005f4afea
commit 11cc8262bc

View File

@@ -307,7 +307,7 @@
</p> </p>
{% endraw %} {% endraw %}
<div v-if="canPay" class="row q-mt-lg"> <div v-if="canPay" class="row q-mt-lg">
<q-btn unelevated color="primary" @click="melt">Pay</q-btn> <q-btn unelevated color="primary" :disabled="payInvoiceData.blocking" @click="melt">Pay</q-btn>
<q-btn v-close-popup flat color="grey" class="q-ml-auto" <q-btn v-close-popup flat color="grey" class="q-ml-auto"
>Cancel</q-btn >Cancel</q-btn
> >
@@ -759,6 +759,7 @@
}, },
invoiceCheckListener: () => {}, invoiceCheckListener: () => {},
payInvoiceData: { payInvoiceData: {
blocking: false,
// invoice: '', // invoice: '',
bolt11: '', bolt11: '',
// camera: { // camera: {
@@ -1590,6 +1591,7 @@
return {fristProofs, scndProofs} return {fristProofs, scndProofs}
} catch (error) { } catch (error) {
this.payInvoiceData.blocking = false
console.error(error) console.error(error)
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
throw error throw error
@@ -1680,6 +1682,8 @@
}, },
melt: async function () { melt: async function () {
// todo: get fees from server and add to inputs // todo: get fees from server and add to inputs
this.payInvoiceData.blocking = true
console.log('#### pay lightning') console.log('#### pay lightning')
const amount_invoice = this.payInvoiceData.invoice.sat const amount_invoice = this.payInvoiceData.invoice.sat
const amount = const amount =
@@ -1718,9 +1722,8 @@
type: 'positive', type: 'positive',
message: 'Invoice paid' message: 'Invoice paid'
}) })
// delete tokens from db // delete spent tokens from db
this.proofs = fristProofs this.proofs = fristProofs
// add new fristProofs, scndProofs to this.proofs
this.storeProofs() this.storeProofs()
console.log({ console.log({
amount: -amount, amount: -amount,
@@ -1741,8 +1744,10 @@
this.payInvoiceData.invoice = false this.payInvoiceData.invoice = false
this.payInvoiceData.show = false this.payInvoiceData.show = false
this.payInvoiceData.blocking = false
} catch (error) { } catch (error) {
this.payInvoiceData.blocking = false
console.error(error) console.error(error)
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
throw error throw error