From e19cf3c81d4e45654442233afd4a002afeaa5143 Mon Sep 17 00:00:00 2001 From: odc.xiaohui <xiaohui@Q1> Date: 星期一, 04 十二月 2023 17:54:53 +0800 Subject: [PATCH] 修改视频专网 --- src/utils/request.ts | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 6178701..ebd7d89 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -11,6 +11,7 @@ import { encryptBase64, encryptWithAes, generateAesKey } from '@/utils/crypto'; import { encrypt } from '@/utils/jsencrypt'; import router from "@/router"; +import { ElLoading, ElMessage, ElNotification } from "element-plus"; let downloadLoadingInstance: LoadingInstance; // 鏄惁鏄剧ず閲嶆柊鐧诲綍 @@ -94,9 +95,10 @@ } ); + // 鍝嶅簲鎷︽埅鍣� service.interceptors.response.use( - (res: AxiosResponse) => { + async (res: AxiosResponse) => { // 鏈缃姸鎬佺爜鍒欓粯璁ゆ垚鍔熺姸鎬� const code = res.data.code || HttpStatus.SUCCESS; // 鑾峰彇閿欒淇℃伅 @@ -106,8 +108,12 @@ return res.data; } if (code === 401) { - console.log(code,'code=============='); - router.push({ path: '/login' }); + + const userStore = useUserStore(); + await userStore.logout() + + console.log(code, 'code=============='); + await router.push({ path: '/login' }); // prettier-ignore // if (!isRelogin.show) { // // isRelogin.show = true; @@ -125,7 +131,8 @@ // isRelogin.show = false; // }); // } - return Promise.reject('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�'); + // return Promise.reject('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�'); + return } else if (code === HttpStatus.SERVER_ERROR) { console.log(msg); ElMessage({ message: msg, type: 'error' }); -- Gitblit v1.8.0