fix: authorization
Some checks failed
coverage CI / build (push) Has been cancelled

This commit is contained in:
2025-10-13 17:01:18 +08:00
parent ed92397237
commit a5b7207f44
2 changed files with 4 additions and 2 deletions

View File

@@ -188,7 +188,7 @@ export const request: RequestConfig = {
};
// 如果有token则添加Authorization头
if (token) {
headers.Authorization = `Bearer·${getAccessToken()}`;
headers.Authorization = `Bearer ${getAccessToken()}`;
}
return { url, options: { ...options, headers } };
},

View File

@@ -178,7 +178,9 @@ export const errorConfig: RequestConfig = {
// 2.1 刷新成功,则回放队列的请求 + 当前请求
setToken(refreshTokenRes);
// 发出 token 刷新事件
requestEventBus.emit('token-refreshed');
// 刷新当前路由
// window.location.reload();
// requestEventBus.emit('token-refreshed');
} catch (_) {
// 为什么需要 catch 异常呢?刷新失败时,请求因为 Promise.reject 触发异常。
// 提示是否要登出。即不回放当前请求!不然会形成递归