get project

This commit is contained in:
hamid zarghami
2026-07-11 11:40:55 +03:30
parent 651fb16feb
commit 9c84048730
4 changed files with 40 additions and 17 deletions
@@ -18,6 +18,14 @@ export const useGetProjectDetail = (id: string) => {
});
};
export const useGetProject = (id: string) => {
return useQuery({
queryKey: ["project", id],
queryFn: () => api.getProject(id),
enabled: !!id,
});
};
export const useCreateProject = () => {
const queryClient = useQueryClient();
@@ -35,13 +43,7 @@ export const useUpdateProject = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
id,
params,
}: {
id: string;
params: UpdateProjectType;
}) => api.updateProject(id, params),
mutationFn: ({ id, params }: { id: string; params: UpdateProjectType }) => api.updateProject(id, params),
onSuccess: (_data, variables) => {
queryClient.invalidateQueries({ queryKey: ["projects"] });
queryClient.invalidateQueries({