取消
This commit is contained in:
@@ -66,12 +66,6 @@ export async function apiRequest<T>(path: string, options: RequestOptions = {}):
|
||||
if (token) headers['Authorization'] = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
// 开发者访问令牌(网站关闭时用于绕过限制)
|
||||
const devAccessToken = localStorage.getItem('dev_access_token');
|
||||
if (devAccessToken) {
|
||||
headers['X-Dev-Access'] = devAccessToken;
|
||||
}
|
||||
|
||||
let bodyStr: string | undefined;
|
||||
if (body !== undefined) {
|
||||
const json = JSON.stringify(body);
|
||||
@@ -116,13 +110,6 @@ export async function apiRequest<T>(path: string, options: RequestOptions = {}):
|
||||
|
||||
// Handle error responses
|
||||
if (!res.ok) {
|
||||
// 网站关闭 → 跳转到维护页面
|
||||
if (res.status === 503 && parsed?.detail?.code === 'SITE_CLOSED') {
|
||||
if (!window.location.pathname.startsWith('/maintenance')) {
|
||||
window.location.href = '/maintenance';
|
||||
}
|
||||
throw new Error(parsed?.detail?.message || '系统正在升级维护');
|
||||
}
|
||||
let msg = parsed?.detail?.message || parsed?.message || `请求失败 (${res.status})`;
|
||||
if (typeof parsed?.detail === 'string') {
|
||||
msg = parsed.detail;
|
||||
|
||||
Reference in New Issue
Block a user