fix(mining-admin-web): 解包 mining-admin-service 响应的 TransformInterceptor 包装
mining-admin-service 也使用 TransformInterceptor 将所有响应包装为 { success, data, timestamp } 结构,
前端需要从 res.data.data 中提取实际数据。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
30a82f09f3
commit
8f0fc09a4c
|
|
@ -114,7 +114,9 @@ export default function BatchMiningPage() {
|
|||
try {
|
||||
const res = await apiClient.get('/batch-mining/status');
|
||||
console.log('[BatchMining] 状态响应:', res.data);
|
||||
return res.data;
|
||||
// mining-admin-service 使用 TransformInterceptor 包装响应为 { success, data, timestamp }
|
||||
const data = res.data?.data || res.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error('[BatchMining] 获取状态失败:', error);
|
||||
throw error;
|
||||
|
|
@ -130,7 +132,9 @@ export default function BatchMiningPage() {
|
|||
try {
|
||||
const res = await apiClient.get('/batch-mining/execution');
|
||||
console.log('[BatchMining] 执行记录响应:', res.data);
|
||||
return res.data as BatchExecution;
|
||||
// mining-admin-service 使用 TransformInterceptor 包装响应为 { success, data, timestamp }
|
||||
const data = res.data?.data || res.data;
|
||||
return data as BatchExecution;
|
||||
} catch (error) {
|
||||
console.error('[BatchMining] 获取执行记录失败:', error);
|
||||
return null;
|
||||
|
|
@ -150,7 +154,9 @@ export default function BatchMiningPage() {
|
|||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
});
|
||||
console.log('[BatchMining] 上传预览响应:', res.data);
|
||||
return res.data as BatchPreviewResult;
|
||||
// mining-admin-service 使用 TransformInterceptor 包装响应为 { success, data, timestamp }
|
||||
const data = res.data?.data || res.data;
|
||||
return data as BatchPreviewResult;
|
||||
} catch (error: any) {
|
||||
console.error('[BatchMining] 上传预览失败:', error.response?.status, error.response?.data);
|
||||
throw error;
|
||||
|
|
@ -181,7 +187,9 @@ export default function BatchMiningPage() {
|
|||
try {
|
||||
const res = await apiClient.post('/batch-mining/execute', data);
|
||||
console.log('[BatchMining] 执行响应:', res.data);
|
||||
return res.data;
|
||||
// mining-admin-service 使用 TransformInterceptor 包装响应为 { success, data, timestamp }
|
||||
const result = res.data?.data || res.data;
|
||||
return result;
|
||||
} catch (error: any) {
|
||||
console.error('[BatchMining] 执行失败:', error.response?.status, error.response?.data);
|
||||
throw error;
|
||||
|
|
|
|||
Loading…
Reference in New Issue