fix: 修复任务运行响应处理,更新任务编辑页面以正确显示记录ID
This commit is contained in:
parent
1a480fdd6d
commit
1fb9245883
@ -109,7 +109,7 @@ export default function TaskEditScreen() {
|
||||
|
||||
const result = await runTaskService(request);
|
||||
setRunResponse(result);
|
||||
Alert.alert('成功', `任务已启动, 记录ID: ${result.data.taskRecordId}`);
|
||||
Alert.alert('成功', `任务已启动, 记录ID: ${result.taskRecordId}`);
|
||||
} catch (error: any) {
|
||||
Alert.alert('运行失败', error.message || '发生未知错误');
|
||||
} finally {
|
||||
|
@ -44,6 +44,14 @@ api.interceptors.request.use(
|
||||
// 响应拦截器
|
||||
api.interceptors.response.use(
|
||||
response => {
|
||||
// 打印响应数据用于调试
|
||||
console.log(
|
||||
`[Response] ${response.config.method?.toUpperCase()} ${
|
||||
response.config.url
|
||||
}`,
|
||||
response.data,
|
||||
);
|
||||
|
||||
// 统一处理API响应
|
||||
if (response.data && response.data.code && response.data.code !== 200) {
|
||||
throw new Error(`API 错误: ${response.data.message}`);
|
||||
|
@ -81,15 +81,11 @@ export interface RunTaskRequest {
|
||||
}
|
||||
|
||||
// 运行任务响应数据
|
||||
export interface RunTaskResponseData {
|
||||
export interface RunTaskApiResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
taskRecordId: string;
|
||||
status: number;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
// 运行任务API响应
|
||||
export interface RunTaskApiResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
data: RunTaskResponseData;
|
||||
isPeriodic: boolean;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user