auto-sync: 2026-05-21 00:14:49
This commit is contained in:
@@ -236,18 +236,16 @@ export const api = {
|
||||
|
||||
createTask: async (data: CreateTaskPayload): Promise<ActionResult & { taskId?: string }> => {
|
||||
try {
|
||||
// 优先用 CreateTaskModal 传入的 project_type(实际是 projectId),其次用当前选中项目
|
||||
const pid = data.project_type || _currentProjectId || '_general';
|
||||
const prio = typeof data.priority === 'string' ? parseInt(data.priority, 10) || 5 : 5;
|
||||
// title 为空时不传,后端自动生成
|
||||
const payload: any = {
|
||||
id: `task-${Date.now().toString(36)}`,
|
||||
description: data.requirement || data.title || '',
|
||||
task_type: 'general',
|
||||
priority: prio,
|
||||
assigned_by: 'user',
|
||||
};
|
||||
if (data.title && data.title.trim()) payload.title = data.title.trim();
|
||||
// ID 由后端生成,不传 id 字段
|
||||
return postJ(`${API_BASE}/api/projects/${pid}/tasks`, payload);
|
||||
} catch (e: any) {
|
||||
return { ok: false, error: e.message };
|
||||
|
||||
Reference in New Issue
Block a user