diff --git a/components/flow.tsx b/components/flow.tsx index aaf3c821..01bee0d5 100644 --- a/components/flow.tsx +++ b/components/flow.tsx @@ -72,7 +72,7 @@ export function Flow() { if (!response.ok) { throw new Error('Failed to fetch tasks'); } - const data = await response.json(); + const data: ApiResponse = await response.json(); // Extract tasks from the result property const tasksList = data.result || []; @@ -83,9 +83,8 @@ export function Flow() { return; } - // Filter tasks with status 3 and sort by date - const filteredAndSortedTasks = tasksList - .filter((task: Task) => task.status === 3 && task.userId === 2) + // Sort tasks by date and limit to 4 + const sortedTasks = tasksList .sort((a: Task, b: Task) => { const dateA = a.dateToFinish ? new Date(a.dateToFinish).getTime() : a.date ? new Date(a.date).getTime() : Date.now(); @@ -95,8 +94,7 @@ export function Flow() { }) .slice(0, 4); // Limit to 4 tasks - console.log('Filtered tasks:', filteredAndSortedTasks); // Debug log - setTasks(filteredAndSortedTasks); + setTasks(sortedTasks); } catch (error) { console.error('Error fetching tasks:', error); setError('Failed to fetch tasks'); @@ -112,7 +110,7 @@ export function Flow() { return ( - Flow + Flow