@jetlinks-web/core 2.2.2 → 2.2.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/package.json +1 -1
- package/src/axios.ts +4 -4
package/package.json
CHANGED
package/src/axios.ts
CHANGED
|
@@ -13,12 +13,12 @@ import {isFunction, isObject} from 'lodash-es'
|
|
|
13
13
|
interface Options {
|
|
14
14
|
|
|
15
15
|
tokenExpiration: (err: AxiosError<any>, response: AxiosResponse) => void
|
|
16
|
-
handleReconnect: (
|
|
16
|
+
handleReconnect: () => Promise<any>
|
|
17
17
|
filter_url?: Array<string>
|
|
18
18
|
code?: number
|
|
19
19
|
codeKey?: string
|
|
20
20
|
timeout?: number
|
|
21
|
-
handleRequest?: () =>
|
|
21
|
+
handleRequest?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig
|
|
22
22
|
/**
|
|
23
23
|
* 用以获取localstorage中的lang
|
|
24
24
|
*/
|
|
@@ -59,7 +59,7 @@ let _options: Options = {
|
|
|
59
59
|
langKey: 'lang',
|
|
60
60
|
requestOptions: (config) => ({}),
|
|
61
61
|
tokenExpiration: () => {},
|
|
62
|
-
handleReconnect: () =>
|
|
62
|
+
handleReconnect: () => Promise.resolve(),
|
|
63
63
|
isCreateTokenRefresh: false
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -155,7 +155,7 @@ const createTokenRefreshHandler = async (err) => {
|
|
|
155
155
|
failedQueue.push({ resolve, reject });
|
|
156
156
|
}).then((_token) => {
|
|
157
157
|
originalRequest.headers[TOKEN_KEY] = _token;
|
|
158
|
-
instance(originalRequest)
|
|
158
|
+
return instance(originalRequest)
|
|
159
159
|
}).catch(err => Promise.reject(err))
|
|
160
160
|
}
|
|
161
161
|
originalRequest._retry = true;
|