From af5a9d9108bfc3db6e72e81c78c54e23af5cbbf5 Mon Sep 17 00:00:00 2001 From: Thomas <9749173+uhthomas@users.noreply.github.com> Date: Tue, 26 Sep 2023 00:20:01 +0100 Subject: [PATCH] chore(web): use axios isCancel function (#4227) Use of this function should be more idiomatic and reliable - it's much less likely for changes to Axios to cause regressions. --- web/src/lib/utils/handle-error.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/lib/utils/handle-error.ts b/web/src/lib/utils/handle-error.ts index 006823ebb8..1e64720159 100644 --- a/web/src/lib/utils/handle-error.ts +++ b/web/src/lib/utils/handle-error.ts @@ -1,5 +1,5 @@ import type { ApiError } from '@api'; -import * as axios from 'axios'; +import axios from 'axios'; import { notificationController, NotificationType } from '../components/shared-components/notification/notification'; export async function getServerErrorMessage(error: unknown) { @@ -17,7 +17,7 @@ export async function getServerErrorMessage(error: unknown) { } export async function handleError(error: unknown, message: string) { - if (error instanceof axios.CanceledError) { + if (axios.isCancel(error)) { return; }