fix: allow api error interceptor to handle api call failure (#8513)
* letting error interceptor take care of api call failure * minor fix
This commit is contained in:
parent
813af16dba
commit
82c033c785
|
|
@ -12,6 +12,7 @@ export type ResponseMeta = {
|
|||
export type ApiResponse = {
|
||||
responseMeta: ResponseMeta;
|
||||
data: any;
|
||||
code?: string;
|
||||
};
|
||||
|
||||
export type GenericApiResponse<T> = {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import {
|
|||
} from "constants/messages";
|
||||
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { axiosConnectionAbortedCode } from "../api/ApiUtils";
|
||||
|
||||
/**
|
||||
* making with error message with action name
|
||||
|
|
@ -70,6 +71,12 @@ export function* validateResponse(response: ApiResponse | any, show = true) {
|
|||
if (!response) {
|
||||
throw Error("");
|
||||
}
|
||||
|
||||
// letting `apiFailureResponseInterceptor` handle it this case
|
||||
if (response?.code === axiosConnectionAbortedCode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!response.responseMeta && !response.status) {
|
||||
throw Error(getErrorMessage(0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user