diff --git a/frontend/src/api/s2a.ts b/frontend/src/api/s2a.ts index 11ae1ad..c230b87 100644 --- a/frontend/src/api/s2a.ts +++ b/frontend/src/api/s2a.ts @@ -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