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