From 01a049ef9ee94d3b4193df8b93f30abca6aa2b7e Mon Sep 17 00:00:00 2001 From: tone <3341154833@qq.com> Date: Fri, 6 Sep 2024 15:38:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=8A=A0=E5=85=A5request?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E4=BB=B6=EF=BC=8CjwtToken=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=B8=85=E9=99=A4localstorage=E5=8F=8A?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tonecn/src/lib/request.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tonecn/src/lib/request.ts b/tonecn/src/lib/request.ts index a49689d..b885856 100644 --- a/tonecn/src/lib/request.ts +++ b/tonecn/src/lib/request.ts @@ -1,8 +1,14 @@ import axios from "axios"; -axios.defaults.baseURL = "http://localhost:23500"; +// axios.defaults.baseURL = "http://localhost:23500"; +axios.defaults.baseURL = "https://tonesc.cn/apis"; axios.interceptors.response.use((response) => { + if(response.data && response.data.code == -5){ + // auth error + localStorage.removeItem('jwtToken'); + window.location.reload() + } // 确保响应数据符合ResponseData接口的结构 return response.data; });