From 2542ae393e12cee28b2ffd81a3e6723386c58492 Mon Sep 17 00:00:00 2001 From: liudong <liudong> Date: 星期四, 15 八月 2024 15:07:26 +0800 Subject: [PATCH] 新建对话页面开发 --- src/api/interceptor.ts | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/api/interceptor.ts b/src/api/interceptor.ts index 40b4b38..a58d192 100644 --- a/src/api/interceptor.ts +++ b/src/api/interceptor.ts @@ -17,7 +17,7 @@ } if (import.meta.env.VITE_API_BASE_URL) { - axios.defaults.baseURL = import.meta.env.VITE_API_BASE_URL; + // axios.defaults.baseURL = import.meta.env.VITE_API_BASE_URL; } axios.defaults.withCredentials = true; axios.interceptors.request.use( @@ -41,7 +41,8 @@ } config.headers.Authorization = `${authorization}`; } - // config.headers.Authorization = 'ImI1ZjBiMTE4NGE5MDExZWZhODMxMDI0MmFjMTIwMDA2Ig.ZqJeng.mxAf4MaEIp_v6jiQqEe3B13xaNE'; + // config.headers.Authorization = + // 'ImE4NGQ4ZWNjNGVmYjExZWZiZjRkMDI0MmFjMTIwMDA2Ig.ZqnIBw.ZX7_UxnSBKu8x_riQ5FrHLMAS78'; return config; }, (error) => { @@ -53,11 +54,10 @@ axios.interceptors.response.use( (response: AxiosResponse<HttpResponse>) => { const res = response.data; - // if the custom code is not 20000, it is judged as an error. if ( (res.retcode && res.retcode !== 0) || - (res.code && res.code !== 20000) + (res.code && res.code !== 20000 && res.code !== 200) ) { Message.error({ content: res.msg || 'Error', @@ -75,7 +75,6 @@ okText: 'Re-Login', async onOk() { const userStore = useUserStore(); - await userStore.logout(); window.location.reload(); }, -- Gitblit v1.8.0