delete section
This commit is contained in:
@@ -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"],
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user