feat: add S2A API client for dashboard, account, group, and proxy management with backend proxy handling.

This commit is contained in:
2026-01-30 09:39:36 +08:00
parent 23a8e7475e
commit a58e2a6502

View File

@@ -42,7 +42,19 @@ export class S2AClient {
) )
} }
return response.json() const json = await response.json()
// S2A API 返回格式: { code: 0, message: "success", data: {...} }
// 需要提取 data 字段
if (json && typeof json === 'object' && 'code' in json && 'data' in json) {
if (json.code !== 0) {
throw new Error(json.message || 'API error')
}
return json.data as T
}
// 如果不是标准格式,直接返回
return json as T
} }
// Dashboard APIs // Dashboard APIs