From 6ed624861dda453e4201a72bd569ed1164e4376b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 9 May 2022 22:49:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20refresh=20token=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=B9=B6=E6=8E=A5=E5=85=A5=E5=88=B0?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin/src/utils/request.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yudao-ui-admin/src/utils/request.js b/yudao-ui-admin/src/utils/request.js index 5da97c14e..d15bf27ce 100644 --- a/yudao-ui-admin/src/utils/request.js +++ b/yudao-ui-admin/src/utils/request.js @@ -9,7 +9,7 @@ import {refreshToken} from "@/api/login"; // 是否显示重新登录 export let isRelogin = { show: false }; -// Axios 无感知刷新令牌,参考 https://www.dashingdog.cn/article/11 实现 +// Axios 无感知刷新令牌,参考 https://www.dashingdog.cn/article/11 与 https://segmentfault.com/a/1190000020210980 实现 // 请求队列 let requestList = [] // 是否正在刷新中 @@ -87,7 +87,8 @@ service.interceptors.response.use( async res => { requestList.forEach(cb => cb()) return service(res.config) } catch (e) { - // 2.1 刷新失败,则只能执行登出操作 + // 2.2 刷新失败,则只能执行登出操作 + // 为什么需要 catch 异常呢?刷新失败时,请求因为 Promise.reject 触发异常。 return handleAuthorized(); } finally { requestList = []