delete section

This commit is contained in:
hamid zarghami
2026-02-02 10:19:39 +03:30
parent 7f2000ec6d
commit 41acb02611
3 changed files with 30 additions and 5 deletions
+18
View File
@@ -17,8 +17,14 @@ export const useGetSectionsDetail = (id: number) => {
};
export const useCreateSection = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: api.createSection,
onSuccess: () => {
queryClient.refetchQueries({
queryKey: ["sections"],
});
},
});
};
@@ -37,3 +43,15 @@ export const useUpdateSection = () => {
},
});
};
export const useDeleteSection = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (id: number) => api.deleteSection(id),
onSuccess: () => {
queryClient.refetchQueries({
queryKey: ["sections"],
});
},
});
};