mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-04-24 23:47:17 +08:00
perf: test
This commit is contained in:
parent
ca89c4c501
commit
90d1cb8c98
@ -38,25 +38,12 @@ class PureHttp {
|
|||||||
/** token过期后,暂存待执行的请求 */
|
/** token过期后,暂存待执行的请求 */
|
||||||
private static requests = [];
|
private static requests = [];
|
||||||
|
|
||||||
/** 防止重复刷新token */
|
|
||||||
private static isRefreshing = false;
|
|
||||||
|
|
||||||
/** 初始化配置对象 */
|
/** 初始化配置对象 */
|
||||||
private static initConfig: PureHttpRequestConfig = {};
|
private static initConfig: PureHttpRequestConfig = {};
|
||||||
|
|
||||||
/** 保存当前Axios实例对象 */
|
/** 保存当前Axios实例对象 */
|
||||||
private static axiosInstance: AxiosInstance = Axios.create(defaultConfig);
|
private static axiosInstance: AxiosInstance = Axios.create(defaultConfig);
|
||||||
|
|
||||||
/** 重连原始请求 */
|
|
||||||
private static retryOriginalRequest(config: PureHttpRequestConfig) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
PureHttp.requests.push((token: string) => {
|
|
||||||
config.headers["Authorization"] = formatToken(token);
|
|
||||||
resolve(config);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 请求拦截 */
|
/** 请求拦截 */
|
||||||
private httpInterceptorsRequest(): void {
|
private httpInterceptorsRequest(): void {
|
||||||
PureHttp.axiosInstance.interceptors.request.use(
|
PureHttp.axiosInstance.interceptors.request.use(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user