Skip to content

Commit

Permalink
fix: await retry mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed Nov 5, 2024
1 parent 7838c33 commit 1a14f8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/use-paid-mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ export function usePaidMutation (mutation,
} catch (err) {
console.error('usePaidMutation: failed to cancel invoice', err)
}
const retry = retryPaidAction({ variables: { invoiceId: parseInt(invoice.id) } })
const retry = await retryPaidAction({ variables: { invoiceId: parseInt(invoice.id) } })
response = retry.data?.retryPaidAction
invoice = response?.invoice
} else break
}

// we try one last time using fee credits
try {
const retry = retryPaidAction({ variables: { invoiceId: parseInt(invoice.id), forceFeeCredit: true } })
const retry = await retryPaidAction({ variables: { invoiceId: parseInt(invoice.id), forceFeeCredit: true } })
response = retry.data?.retryPaidAction
// we paid with fee credits, so we don't need the invoice anymore
invoiceHelper.cancel(invoice).catch(console.error)
Expand Down

0 comments on commit 1a14f8d

Please sign in to comment.