mirror of
https://github.com/sakaljurgis/best-choice.git
synced 2026-07-08 21:47:40 +00:00
delete project
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
fetchProject,
|
||||
fetchProjects,
|
||||
updateProject,
|
||||
deleteProject,
|
||||
type CreateProjectPayload,
|
||||
type ProjectsListResponse,
|
||||
type UpdateProjectPayload
|
||||
@@ -116,3 +117,16 @@ export const useUpdateItemMutation = (projectId: string | undefined) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useDeleteProjectMutation = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (projectId: string) => deleteProject(projectId),
|
||||
onSuccess: (_, projectId) => {
|
||||
queryClient.invalidateQueries({ queryKey: projectsKeys.list() });
|
||||
queryClient.removeQueries({ queryKey: projectsKeys.detail(projectId) });
|
||||
queryClient.removeQueries({ queryKey: projectsKeys.items(projectId) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user