feat: add S2A API client for dashboard, account, group, and proxy management with backend proxy handling.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user