Skip to content

Commit

Permalink
fix(send): add alert if aborting taker operation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
theborakompanioni committed Jan 26, 2024
1 parent c3a354d commit 36a9459
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,12 @@ export default function Send({ wallet }: SendProps) {
setAlert(undefined)

const abortCtrl = new AbortController()
return Api.getTakerStop({ ...wallet, signal: abortCtrl.signal }).catch((err) => {
if (abortCtrl.signal.aborted) return
setAlert({ variant: 'danger', message: err.message })
})
return Api.getTakerStop({ ...wallet, signal: abortCtrl.signal })
.then((res) => (res.ok ? true : Api.Helper.throwError(res)))
.catch((err) => {
if (abortCtrl.signal.aborted) return
setAlert({ variant: 'danger', message: err.message })
})
}

const onSubmit = async (values: SendFormValues) => {
Expand Down

0 comments on commit 36a9459

Please sign in to comment.