This repository has no description
515 B
19 lines
1import { useMutation, useQueryClient } from '@tanstack/react-query';
2import { deleteCollection } from '../dal';
3import { collectionKeys } from '../collectionKeys';
4
5export default function useDeleteCollection() {
6 const queryClient = useQueryClient();
7
8 const mutation = useMutation({
9 mutationFn: (collectionId: string) => {
10 return deleteCollection(collectionId);
11 },
12
13 onSuccess: () => {
14 queryClient.invalidateQueries({ queryKey: collectionKeys.all() });
15 },
16 });
17
18 return mutation;
19}