feat: 登录界面优化与API代理配置
- 移除登录页面的登录/注册切换,只保留登录功能 - 添加API代理配置支持远程访问 - 添加favicon.ico - 后端CORS配置支持前端访问 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a89d4f2402
commit
02f48927a3
+7
-1
@@ -1,4 +1,4 @@
|
||||
const API_BASE = ''; // 使用相对路径,同源代理
|
||||
const API_BASE = ''; // 使用相对路径
|
||||
|
||||
function getAuthHeaders() {
|
||||
const token = typeof window !== 'undefined' ? localStorage.getItem('token') : null;
|
||||
@@ -15,6 +15,12 @@ async function apiCall(url, options = {}) {
|
||||
},
|
||||
});
|
||||
|
||||
const contentType = res.headers.get('content-type');
|
||||
if (!contentType || !contentType.includes('application/json')) {
|
||||
const text = await res.text();
|
||||
throw new Error(`服务器错误: ${res.status} - ${text.substring(0, 100)}`);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (!res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user