This commit is contained in:
Alex Yang
2025-12-16 00:17:05 +08:00
parent 11d39d6b76
commit c0ddaf8b44
49 changed files with 1514 additions and 941752 deletions

View File

@@ -38,6 +38,13 @@ async function apiRequest(endpoint, method = 'GET', data = null) {
// 优化错误响应处理
console.warn(`API请求失败: ${response.status}`);
// 处理401未授权错误重定向到登录页面
if (response.status === 401) {
console.warn('未授权访问,重定向到登录页面');
window.location.href = '/login';
return { error: '未授权访问' };
}
// 尝试解析JSON但如果失败直接使用原始文本作为错误信息
try {
const errorData = JSON.parse(responseText);