From 1d8b6097ab80e3a5ed6467f8a48c41df2b32cefb Mon Sep 17 00:00:00 2001 From: talktao Date: Thu, 29 Sep 2022 15:18:10 +0800 Subject: [PATCH] test --- src/uitls/request.ts | 10 ++++------ src/views/home/Home.vue | 11 +++++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/uitls/request.ts b/src/uitls/request.ts index 643ce28..8a2439e 100644 --- a/src/uitls/request.ts +++ b/src/uitls/request.ts @@ -30,21 +30,21 @@ class HttpRequest { }; } interceptors(instance: AxiosInstance) { + + // 定义存放请求接口数组 let requestList = []; const setLoadingToFalse = response => { - requestList .filter(item => item.url == response.config.url && item.method == response.config.method) .forEach(item => (item.isLoading = false)); //所有请求都加载完才让加载提示消失 if (requestList.every(item => !item.isLoading)) vuexStore.commit("changeIsLoading", false); - }; instance.interceptors.request.use( (config: any) => { - + // 不用判断请求loading的路由 let ignoreLoadingUrls = ["/login"]; if (!ignoreLoadingUrls.includes(config.url)) { @@ -67,9 +67,7 @@ class HttpRequest { return response.data; }, error => { - if (error.response.status == 301) { - vuexStore.commit("changeLoginModalVisible", true); - } + if (error.response.status == 301) { } setLoadingToFalse(error); return Promise.reject(error.response?.data); } diff --git a/src/views/home/Home.vue b/src/views/home/Home.vue index f80d468..98e3fee 100644 --- a/src/views/home/Home.vue +++ b/src/views/home/Home.vue @@ -1,6 +1,6 @@