diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 10f7550..1a67bc3 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -39,6 +39,7 @@ class RequestHttp { */ this.service.interceptors.request.use( (config: CustomAxiosRequestConfig) => { + isFirst = true const userStore = useUserStore() // 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制 config.loading ?? (config.loading = true) @@ -89,7 +90,7 @@ class RequestHttp { userStore.setRefreshToken('') userStore.setIsRefreshToken(false) userStore.setUserInfo({ name: '' }) - router.replace(LOGIN_URL) + await router.replace(LOGIN_URL) if(isFirst){//临时处理token失效弹窗多次 ElMessage.error(data.message) isFirst = false