fix: UX disable "Send" button after clicking when paying LUD16 (#4034)
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -116,6 +116,7 @@ window.localisation.en = {
|
|||||||
read: 'Read',
|
read: 'Read',
|
||||||
write: 'Write',
|
write: 'Write',
|
||||||
pay: 'Pay',
|
pay: 'Pay',
|
||||||
|
sending: 'Sending',
|
||||||
memo: 'Memo',
|
memo: 'Memo',
|
||||||
date: 'Date',
|
date: 'Date',
|
||||||
path: 'Path',
|
path: 'Path',
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ window.PageWallet = {
|
|||||||
invoice: null,
|
invoice: null,
|
||||||
lnurlpay: null,
|
lnurlpay: null,
|
||||||
lnurlauth: null,
|
lnurlauth: null,
|
||||||
|
sending: false,
|
||||||
data: {
|
data: {
|
||||||
request: '',
|
request: '',
|
||||||
amount: 0,
|
amount: 0,
|
||||||
@@ -131,6 +132,7 @@ window.PageWallet = {
|
|||||||
this.parse.data.request = ''
|
this.parse.data.request = ''
|
||||||
this.parse.data.comment = ''
|
this.parse.data.comment = ''
|
||||||
this.parse.data.internalMemo = null
|
this.parse.data.internalMemo = null
|
||||||
|
this.parse.sending = false
|
||||||
this.parse.data.paymentChecker = null
|
this.parse.data.paymentChecker = null
|
||||||
this.parse.camera.show = false
|
this.parse.camera.show = false
|
||||||
},
|
},
|
||||||
@@ -362,6 +364,9 @@ window.PageWallet = {
|
|||||||
this.parse.invoice = Object.freeze(cleanInvoice)
|
this.parse.invoice = Object.freeze(cleanInvoice)
|
||||||
},
|
},
|
||||||
payInvoice() {
|
payInvoice() {
|
||||||
|
if (this.parse.sending) return
|
||||||
|
|
||||||
|
this.parse.sending = true
|
||||||
const dismissPaymentMsg = Quasar.Notify.create({
|
const dismissPaymentMsg = Quasar.Notify.create({
|
||||||
timeout: 0,
|
timeout: 0,
|
||||||
message: this.$t('payment_processing')
|
message: this.$t('payment_processing')
|
||||||
@@ -374,6 +379,7 @@ window.PageWallet = {
|
|||||||
this.parse.data.internalMemo
|
this.parse.data.internalMemo
|
||||||
)
|
)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
this.parse.sending = false
|
||||||
dismissPaymentMsg()
|
dismissPaymentMsg()
|
||||||
this.g.updatePayments = !this.g.updatePayments
|
this.g.updatePayments = !this.g.updatePayments
|
||||||
this.parse.show = false
|
this.parse.show = false
|
||||||
@@ -391,13 +397,16 @@ window.PageWallet = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
this.parse.sending = false
|
||||||
dismissPaymentMsg()
|
dismissPaymentMsg()
|
||||||
LNbits.utils.notifyApiError(err)
|
LNbits.utils.notifyApiError(err)
|
||||||
this.g.updatePayments = !this.g.updatePayments
|
this.g.updatePayments = !this.g.updatePayments
|
||||||
this.parse.show = false
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
payLnurl() {
|
payLnurl() {
|
||||||
|
if (this.parse.sending) return
|
||||||
|
|
||||||
|
this.parse.sending = true
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request('post', '/api/v1/payments/lnurl', this.g.wallet.adminkey, {
|
.request('post', '/api/v1/payments/lnurl', this.g.wallet.adminkey, {
|
||||||
res: this.parse.lnurlpay,
|
res: this.parse.lnurlpay,
|
||||||
@@ -408,6 +417,7 @@ window.PageWallet = {
|
|||||||
internalMemo: this.parse.data.internalMemo
|
internalMemo: this.parse.data.internalMemo
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
this.parse.sending = false
|
||||||
this.parse.show = false
|
this.parse.show = false
|
||||||
if (response.data.extra.success_action) {
|
if (response.data.extra.success_action) {
|
||||||
const action = JSON.parse(response.data.extra.success_action)
|
const action = JSON.parse(response.data.extra.success_action)
|
||||||
@@ -464,7 +474,10 @@ window.PageWallet = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(LNbits.utils.notifyApiError)
|
.catch(err => {
|
||||||
|
this.parse.sending = false
|
||||||
|
LNbits.utils.notifyApiError(err)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
authLnurl() {
|
authLnurl() {
|
||||||
const dismissAuthMsg = Quasar.Notify.create({
|
const dismissAuthMsg = Quasar.Notify.create({
|
||||||
|
|||||||
@@ -664,7 +664,8 @@
|
|||||||
unelevated
|
unelevated
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="payInvoice"
|
@click="payInvoice"
|
||||||
:label="$t('pay')"
|
:disable="parse.sending"
|
||||||
|
:label="parse.sending ? $t('sending') + '...' : $t('pay')"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@@ -836,7 +837,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row q-mt-lg">
|
<div class="row q-mt-lg">
|
||||||
<q-btn unelevated color="primary" type="submit">Send</q-btn>
|
<q-btn
|
||||||
|
unelevated
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
:disable="parse.sending"
|
||||||
|
:label="parse.sending ? $t('sending') + '...' : $t('send')"
|
||||||
|
></q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
:label="$t('cancel')"
|
:label="$t('cancel')"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
|
|||||||
Reference in New Issue
Block a user