核心改进: - 401错误:先尝试刷新token,刷新成功则标记后返回null交由上层重试 - 403错误:直接跳转到登录页 - 移除无用的options和httpClient参数 - 简化层次:client.js(清理) -> http.js(业务) -> AuthService(刷新) 具体变更: 1. client.js: handle401Error()只清空token,不处理重定向 2. http.js: - 401优先尝试刷新,失败才跳转登录页 - 403直接跳转登录页 3. AuthService.js: - 刷新成功:标记error._handled=true, error._tokenRefreshed=true,返回null - 刷新失败:调用回调后抛出错误,交由上层处理跳转 - 移除options和httpClient参数 逻辑更清晰:client清理token -> http处理逻辑 -> AuthService刷新token,职责分明 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
16 lines
662 B
JSON
16 lines
662 B
JSON
{
|
|
"permissions": {
|
|
"allow": [
|
|
"Bash(find:*)",
|
|
"Bash(mvn:*)",
|
|
"Bash(node -e \"\ntry {\n const tokenManager = require(''./src/@gold/utils/token-manager.js'');\n console.log(''✅ Default import works:'', typeof tokenManager.getToken);\n \n const { getAccessToken, getDevToken } = require(''./src/@gold/utils/token-manager.js'');\n console.log(''✅ Named import works:'', typeof getAccessToken, typeof getDevToken);\n} catch (e) {\n console.error(''❌ Import failed:'', e.message);\n}\n\")",
|
|
"Bash(cat:*)",
|
|
"Bash(node -e:*)",
|
|
"Bash(git add:*)",
|
|
"Bash(git commit:*)"
|
|
],
|
|
"deny": [],
|
|
"ask": []
|
|
}
|
|
}
|