Skip to content

Commit ff0fa62

Browse files
committed
feat: add date range filtering to my tasks query
Extend the useMyTasks hook to accept optional start and end date parameters for filtering tasks within a specific time range. This allows the ProjectManagement component to display tasks filtered by the selected date range.
1 parent c2a8ce0 commit ff0fa62

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

frontend/src/components/ProjectManagement.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ export default function ProjectManagement({
166166

167167
const authTeamMemberId = userWorkspaceActive.id || null;
168168

169-
const { data, isLoading, error } = useMyTasks(memberId, workspaceId);
169+
const { data, isLoading, error } = useMyTasks(
170+
memberId,
171+
activeWorkspaceId,
172+
tasksStartDate,
173+
tasksEndDate,
174+
);
170175

171176
useEffect(() => {
172177
if (!authTeamMemberId) return;

frontend/src/hooks/useTasks.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,17 @@ export function useDeleteTask() {
150150
);
151151
}
152152

153-
export function useMyTasks(memberId?: string, workspaceId?: string) {
153+
export function useMyTasks(
154+
memberId?: string,
155+
workspaceId?: string,
156+
startDate?: string,
157+
endDate?: string,
158+
) {
154159
return useQuery({
155-
queryKey: ["my-tasks", memberId, workspaceId],
160+
queryKey: ["my-tasks", memberId, workspaceId, startDate, endDate],
156161
queryFn: async () => {
157162
if (!memberId || !workspaceId) return [];
158-
return await getMyTasks(workspaceId, memberId);
163+
return await getMyTasks(memberId, workspaceId, startDate, endDate);
159164
},
160165
enabled: !!memberId && !!workspaceId,
161166
});

0 commit comments

Comments
 (0)