From b4e7be3a13361286ff1f7a1523ea6163aa9a2343 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期六, 14 九月 2024 13:47:09 +0800 Subject: [PATCH] 意向提示 --- src/utils/request.ts | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index fde5c8f..65cb2ad 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,4 +1,4 @@ -import type { AxiosInstance, AxiosRequestConfig } from 'axios'; +import type { AxiosInstance, AxiosRequestConfig, CancelToken } from 'axios'; import axios from 'axios'; import { ElLoadingService, ElMessage } from 'element-plus'; import router from '../router'; @@ -10,6 +10,7 @@ loading?: boolean; noAuth?: boolean; handleFail?: boolean; + cancelToken?: CancelToken | undefined; }; export const checkAuth = () => { const session = Local.get(accessSessionKey); @@ -37,11 +38,12 @@ clearAccessTokens(); window.location.reload(); }); +window.handleNoAuth = handleNoAuth; let requestNum = 0; let loadingInstance: ReturnType<typeof ElLoadingService>; const addLoading = () => { - // 澧炲姞loading 濡傛灉pending璇锋眰鏁伴噺绛変簬1锛屽脊鍑簂oading, 闃叉閲嶅寮瑰嚭 + // 澧炲姞loading 濡傛灉pending璇锋眰鏁伴噺绛変簬1锛屽脊鍑簂oading, 闃叉閲嶅寮瑰嚭F requestNum++; if (requestNum == 1) { loadingInstance = ElLoadingService({ @@ -61,7 +63,6 @@ // 娣诲姞璇锋眰鎷︽埅鍣� request.interceptors.request.use( (config) => { - console.log('馃殌 ~ config:', config); // 鑾峰彇鏈湴鐨� token const accessSession = Local.get(accessSessionKey); const { loading = true, noAuth = false, handleFail = true } = config as ExtraConfig; -- Gitblit v1.9.3