From 36a9459b7b635ccc35722f7b0a4c38d66dd10942 Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Fri, 26 Jan 2024 22:36:13 +0100 Subject: [PATCH] fix(send): add alert if aborting taker operation fails --- src/components/Send/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Send/index.tsx b/src/components/Send/index.tsx index 0758c6f97..553b14b0b 100644 --- a/src/components/Send/index.tsx +++ b/src/components/Send/index.tsx @@ -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) => {