From 38feef26340d993b1d900281623577a06cb08032 Mon Sep 17 00:00:00 2001 From: Sujit Date: Thu, 1 Aug 2024 16:17:49 +0545 Subject: [PATCH] feat(dashboard): get requested task list --- src/frontend/src/api/dashboard.ts | 14 ++++++++++++++ src/frontend/src/services/project.ts | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 src/frontend/src/api/dashboard.ts diff --git a/src/frontend/src/api/dashboard.ts b/src/frontend/src/api/dashboard.ts new file mode 100644 index 00000000..3b66b639 --- /dev/null +++ b/src/frontend/src/api/dashboard.ts @@ -0,0 +1,14 @@ +/* eslint-disable import/prefer-default-export */ +import { UseQueryOptions, useQuery } from '@tanstack/react-query'; +import { getRequestedTasks } from '@Services/project'; + +export const useGetRequestedTasksListQuery = ( + queryOptions?: Partial, +) => { + return useQuery({ + queryKey: ['requested-task-list'], + queryFn: getRequestedTasks, + select: (res: any) => res.data, + ...queryOptions, + }); +}; diff --git a/src/frontend/src/services/project.ts b/src/frontend/src/services/project.ts index 6d58acc3..8281f0ff 100644 --- a/src/frontend/src/services/project.ts +++ b/src/frontend/src/services/project.ts @@ -10,3 +10,5 @@ export const postTaskStatus = (payload: Record) => { headers: { 'Content-Type': 'application/json' }, }); }; +export const getRequestedTasks = () => + authenticated(api).get('/tasks/requested_tasks/pending');