This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

semble / src / webapp / features / collections / lib / mutations / useDeleteCollection.tsx
651 B 21 lines
1import { useMutation, useQueryClient } from '@tanstack/react-query'; 2import { deleteCollection } from '../dal'; 3import { collectionKeys } from '../collectionKeys'; 4import { profileKeys } from '@/features/profile/lib/profileKeys'; 5 6export default function useDeleteCollection() { 7 const queryClient = useQueryClient(); 8 9 const mutation = useMutation({ 10 mutationFn: (collectionId: string) => { 11 return deleteCollection(collectionId); 12 }, 13 14 onSuccess: () => { 15 queryClient.invalidateQueries({ queryKey: collectionKeys.all() }); 16 queryClient.invalidateQueries({ queryKey: profileKeys.all() }); 17 }, 18 }); 19 20 return mutation; 21}