From ca889288506605b0d0343bea0bd7cf1b6d891f99 Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Wed, 15 Oct 2025 12:45:11 +0530 Subject: [PATCH] added provideAll is flag inside basic projctname api --- src/components/collections/ManageCollection.jsx | 2 +- src/hooks/useProjects.js | 6 +++--- src/repositories/ProjectRepository.jsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/collections/ManageCollection.jsx b/src/components/collections/ManageCollection.jsx index 7f6b0ac6..e31d621b 100644 --- a/src/components/collections/ManageCollection.jsx +++ b/src/components/collections/ManageCollection.jsx @@ -19,7 +19,7 @@ import { formatDate } from "../../utils/dateUtils"; const ManageCollection = ({ collectionId, onClose }) => { const { data, isError, isLoading, error } = useCollection(collectionId); - const { projectNames, projectLoading } = useProjectName(); + const { projectNames, projectLoading } = useProjectName(true); const methods = useForm({ resolver: zodResolver(newCollection), defaultValues: defaultCollection, diff --git a/src/hooks/useProjects.js b/src/hooks/useProjects.js index d540a3ce..7175bb94 100644 --- a/src/hooks/useProjects.js +++ b/src/hooks/useProjects.js @@ -153,7 +153,7 @@ export const useProjectsAllocationByEmployee = (employeeId) => { return { projectList, loading: isLoading, error, refetch }; }; -export const useProjectName = () => { +export const useProjectName = (provideAll=false) => { const { data = [], isLoading, @@ -161,9 +161,9 @@ export const useProjectName = () => { refetch, isError, } = useQuery({ - queryKey: ["basicProjectNameList"], + queryKey: ["basicProjectNameList",provideAll], queryFn: async () => { - const res = await ProjectRepository.projectNameList(); + const res = await ProjectRepository.projectNameList(provideAll); return res.data || res; }, onError: (error) => { diff --git a/src/repositories/ProjectRepository.jsx b/src/repositories/ProjectRepository.jsx index 8f21acb4..06d33c58 100644 --- a/src/repositories/ProjectRepository.jsx +++ b/src/repositories/ProjectRepository.jsx @@ -40,7 +40,7 @@ const ProjectRepository = { api.get(`/api/project/allocation-histery/${id}`), updateProjectsByEmployee: (id, data) => api.post(`/api/project/assign-projects/${id}`, data), - projectNameList: () => api.get("/api/project/list/basic"), + projectNameList: (provideAll) => api.get(`/api/project/list/basic?provideAll=${provideAll}`), getProjectDetails: (id) => api.get(`/api/project/details/${id}`),