This commit is contained in:
2026-08-21 17:20:51 +08:00
parent 8f80b90fc4
commit 641ea7f628
47 changed files with 130068 additions and 32 deletions
+2 -2
View File
@@ -57,7 +57,7 @@ function redirectToLoginAfterSessionExpiry() {
window.location.replace(`/login?redirect=${encodeURIComponent(redirect)}`)
}
async function refreshSession() {
export async function refreshAuthenticatedSession() {
const observedRefreshToken = getRefreshToken()
if (!observedRefreshToken) throw new ApiError('登录已过期,请重新登录', 'A0401', 401)
if (!refreshPromise) {
@@ -103,7 +103,7 @@ transport.interceptors.response.use(
request._retriedAfterRefresh = true
try {
const accessToken = await refreshSession()
const accessToken = await refreshAuthenticatedSession()
request.headers.Authorization = `Bearer ${accessToken}`
return await transport.request(request)
} catch (refreshError) {