react-toolkits 2.14.3 → 2.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.14.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 0beb961: feat: 更新拦截器状态码检查
8
+
3
9
  ## 2.14.3
4
10
 
5
11
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { FormInstance, MenuProps, SelectProps, ModalProps, FormProps, ButtonProps } from 'antd';
6
6
  import { AnyObject } from 'antd/es/_util/type';
7
7
  import { TableProps } from 'antd/es/table';
8
- import { AxiosHeaderValue, AxiosRequestConfig, AxiosInstance, InternalAxiosRequestConfig, AxiosResponse, AxiosInterceptorOptions } from 'axios';
8
+ import { AxiosHeaderValue, AxiosRequestConfig, AxiosInstance, AxiosInterceptorManager, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
9
9
  import * as swr from 'swr';
10
10
  import { MutatorCallback, MutatorOptions, Arguments, SWRResponse } from 'swr';
11
11
  import { ItemType, SubMenuType, MenuItemGroupType, MenuItemType } from 'antd/es/menu/interface';
@@ -377,12 +377,8 @@ interface ContextSlice {
377
377
  collapsible?: boolean;
378
378
  mainPagePath: string;
379
379
  interceptors?: {
380
- request?: [(config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>];
381
- response?: [
382
- (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse>,
383
- ((error: any) => any) | null,
384
- options?: AxiosInterceptorOptions
385
- ];
380
+ request?: Parameters<AxiosInterceptorManager<InternalAxiosRequestConfig>['use']>;
381
+ response?: Parameters<AxiosInterceptorManager<AxiosResponse>['use']>;
386
382
  };
387
383
  setContext(state: Partial<Omit<ContextSlice, 'setContext'>>): void;
388
384
  }
package/lib/index.js CHANGED
@@ -420,7 +420,7 @@ var init_Interceptors = __esm({
420
420
  const responseType = response.request.responseType || "json";
421
421
  if (responseType === "json") {
422
422
  const data = response.data;
423
- if (data.code === 0 || data.code === 200 || data.status === 0 || data.errno === 0) {
423
+ if (data.code === 0 || data.code === 1 || data.code === 200 || data.status === 0 || data.errno === 0) {
424
424
  return response;
425
425
  } else {
426
426
  notification.error({