@acrool/react-fetcher 0.0.2-alpha.4 → 0.0.2-alpha.5
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,13 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { IInternalRequestConfig } from '../fetchers/types';
|
|
4
4
|
import { IResponseFirstError } from './types';
|
|
5
5
|
export declare const AxiosClientContext: React.Context<AxiosInstance | null>;
|
|
6
6
|
export declare const useAxiosClient: () => null;
|
|
7
7
|
interface IProps {
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
axiosInstance: AxiosInstance;
|
|
10
|
-
checkIsRefreshTokenRequest?: (config:
|
|
10
|
+
checkIsRefreshTokenRequest?: (config: IInternalRequestConfig) => boolean;
|
|
11
11
|
locale?: string;
|
|
12
12
|
onError?: (error: IResponseFirstError) => void;
|
|
13
13
|
authorizationPrefix?: string;
|
|
@@ -675,7 +675,10 @@ const fr = dt(null), Yn = ({
|
|
|
675
675
|
E.headers["Accept-Language"] = r;
|
|
676
676
|
const A = (C = d()) == null ? void 0 : C.accessToken;
|
|
677
677
|
if (!((I = E.fetchOptions) == null ? void 0 : I.forceGuest) && A && (E.headers.Authorization = [o, A].filter((X) => X).join(" ")), !(E && s ? s(E) : !1) && Q) {
|
|
678
|
-
T(g, O)(E), O(new lr({
|
|
678
|
+
T(g, O)(E), O(new lr({
|
|
679
|
+
message: "Token refreshing, so request save queues not send",
|
|
680
|
+
code: "REFRESH_TOKEN"
|
|
681
|
+
}));
|
|
679
682
|
return;
|
|
680
683
|
}
|
|
681
684
|
g(E);
|
package/dist/fetchers/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
1
|
+
import { AxiosRequestConfig, InternalAxiosRequestConfig } from 'axios';
|
|
2
2
|
export interface IFetchOptions {
|
|
3
3
|
pendingRequest?: boolean;
|
|
4
4
|
requestCode?: string;
|
|
@@ -6,5 +6,7 @@ export interface IFetchOptions {
|
|
|
6
6
|
leastTime?: number;
|
|
7
7
|
timeout?: number;
|
|
8
8
|
}
|
|
9
|
+
export interface IInternalRequestConfig extends InternalAxiosRequestConfig, IFetchOptions {
|
|
10
|
+
}
|
|
9
11
|
export interface IRequestConfig extends AxiosRequestConfig, IFetchOptions {
|
|
10
12
|
}
|