@acrool/react-fetcher 0.0.7-alpha.1 → 0.0.7-alpha.3

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.
@@ -1,13 +1,14 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { default as React } from 'react';
3
- import { TCheckIsErrorResponse, TCheckIsRefreshTokenRequest, TGetResponseFormatError, TOnResponseError } from './types';
3
+ import { TCheckErrorIs401, TCheckIsErrorResponse, TCheckIsRefreshTokenRequest, TGetResponseFormatError, TOnResponseError } from './types';
4
4
  export declare const AxiosClientContext: React.Context<AxiosInstance | null>;
5
- export declare const useAxiosClient: () => null;
5
+ export declare const useAxiosClient: () => AxiosInstance;
6
6
  interface IProps {
7
7
  children: React.ReactNode;
8
8
  axiosInstance: AxiosInstance;
9
9
  checkIsRefreshTokenRequest?: TCheckIsRefreshTokenRequest;
10
10
  checkIsErrorResponse?: TCheckIsErrorResponse;
11
+ checkErrorIs401?: TCheckErrorIs401;
11
12
  locale?: string;
12
13
  getResponseFormatError?: TGetResponseFormatError;
13
14
  onResponseError?: TOnResponseError;
@@ -21,5 +22,5 @@ interface IProps {
21
22
  * @param locale
22
23
  * @param onResponseError
23
24
  */
24
- declare const FetcherProvider: ({ children, axiosInstance, locale, getResponseFormatError, onResponseError, checkIsRefreshTokenRequest, checkIsErrorResponse, authorizationPrefix, isDebug, }: IProps) => import("react/jsx-runtime").JSX.Element;
25
+ declare const FetcherProvider: ({ children, axiosInstance, locale, getResponseFormatError, onResponseError, checkIsRefreshTokenRequest, checkIsErrorResponse, checkErrorIs401, authorizationPrefix, isDebug, }: IProps) => import("react/jsx-runtime").JSX.Element;
25
26
  export default FetcherProvider;
@@ -1,3 +1,3 @@
1
1
  export { default as FetcherProvider } from './FetcherProvider';
2
2
  export { getGraphQLResponseFormatError, getRestFulResponseFormatError } from './utils';
3
- export type { TGetResponseFormatError, IFormatResponseErrorReturn, TOnResponseError, TCheckIsRefreshTokenRequest, TCheckIsErrorResponse } from './types';
3
+ export type { TGetResponseFormatError, IFormatResponseErrorReturn, TOnResponseError, TCheckIsRefreshTokenRequest, TCheckIsErrorResponse, TCheckErrorIs401, } from './types';
@@ -12,4 +12,5 @@ export interface IFormatResponseErrorReturn {
12
12
  export type TGetResponseFormatError = (axiosError?: AxiosError) => IFormatResponseErrorReturn;
13
13
  export type TCheckIsRefreshTokenRequest = (config: IInternalRequestConfig) => boolean;
14
14
  export type TCheckIsErrorResponse = (response: AxiosResponse) => boolean;
15
+ export type TCheckErrorIs401 = (error: IFormatResponseErrorReturn) => boolean;
15
16
  export type TOnResponseError = (error: IFormatResponseErrorReturn) => void;