Fix onSubmit not ignoring payment cancels from WebLN payments (#842)
This commit is contained in:
parent
5c56267aaa
commit
3d1bcd38c6
@ -802,7 +802,8 @@ export function Form ({
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const msg = err.message || err.toString?.()
|
const msg = err.message || err.toString?.()
|
||||||
// handle errors from JIT invoices by ignoring them
|
// ignore errors from JIT invoices or payments from attached wallets
|
||||||
|
// that mean that submit failed because user aborted the payment
|
||||||
if (msg === 'modal closed' || msg === 'invoice canceled') return
|
if (msg === 'modal closed' || msg === 'invoice canceled') return
|
||||||
toaster.danger('submit error: ' + msg)
|
toaster.danger('submit error: ' + msg)
|
||||||
}
|
}
|
||||||
|
@ -293,13 +293,12 @@ export const useInvoiceable = (onSubmit, options = defaultOptions) => {
|
|||||||
return onSubmitWrapper
|
return onSubmitWrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
const INVOICE_CANCELED_ERROR = 'invoice was canceled'
|
const INVOICE_CANCELED_ERROR = 'invoice canceled'
|
||||||
const waitForPayment = async ({ invoice, showModal, provider, pollInvoice, gqlCacheUpdate }) => {
|
const waitForPayment = async ({ invoice, showModal, provider, pollInvoice, gqlCacheUpdate }) => {
|
||||||
if (provider.enabled) {
|
if (provider.enabled) {
|
||||||
try {
|
try {
|
||||||
return await waitForWebLNPayment({ provider, invoice, pollInvoice, gqlCacheUpdate })
|
return await waitForWebLNPayment({ provider, invoice, pollInvoice, gqlCacheUpdate })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const INVOICE_CANCELED_ERROR = 'invoice was canceled'
|
|
||||||
// check for errors which mean that QR code will also fail
|
// check for errors which mean that QR code will also fail
|
||||||
if (err.message === INVOICE_CANCELED_ERROR) {
|
if (err.message === INVOICE_CANCELED_ERROR) {
|
||||||
throw err
|
throw err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user