zhengyiming
8 天以前 2a681aed4c274560c04ab3699a4ace88abefcb90
src/utils/request/index.ts
@@ -120,6 +120,9 @@
        const errorInfo: ErrorInfo | undefined = (error as any).info;
        if (errorInfo) {
          const { errorMessage, errorCode } = errorInfo;
          if (Number(errorCode) === 401) {
            handleLogout();
          }
          switch (errorInfo.showType) {
            case ErrorShowType.SILENT:
              // do nothing
@@ -145,7 +148,7 @@
      } else if ((error as AxiosError<ResponseStructure, IRequestOptions>).response) {
        // Axios 的错误
        // 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围
        handleAxiosResponseError(error as AxiosError<ErrorResponse, IRequestOptions>);
        handleAxiosResponseError(error as AxiosError<ResponseStructure, IRequestOptions>);
        // Message.errorMessage(`Response status:${(error as AxiosError).response.status}`);
      } else if ((error as AxiosError).request) {
        // 请求已经成功发起,但没有收到响应