aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backend-ui/src/hooks/backend.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backend-ui/src/hooks/backend.ts')
-rw-r--r--packages/merchant-backend-ui/src/hooks/backend.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/merchant-backend-ui/src/hooks/backend.ts b/packages/merchant-backend-ui/src/hooks/backend.ts
index 96b8f7139..044344d5d 100644
--- a/packages/merchant-backend-ui/src/hooks/backend.ts
+++ b/packages/merchant-backend-ui/src/hooks/backend.ts
@@ -209,7 +209,7 @@ export async function request<T>(url: string, options: RequestOptions = {}): Pro
url,
responseType: 'json',
headers,
- cancelToken: !removeAxiosCancelToken? source.token : undefined,
+ cancelToken: !removeAxiosCancelToken ? source.token : undefined,
method: options.method || 'get',
data: options.data,
params: options.params,
@@ -217,8 +217,10 @@ export async function request<T>(url: string, options: RequestOptions = {}): Pro
})
return buildRequestOk<T>(res, url, !!options.token)
} catch (e) {
- const error = buildRequestFailed(e, url, !!options.token)
- throw error
+ if (axios.isAxiosError(e)) {
+ throw buildRequestFailed(e, url, !!options.token)
+ }
+ throw e
}
}