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 / useUpdateCollection.tsx
749 B 29 lines
1import { useMutation, useQueryClient } from '@tanstack/react-query'; 2import { updateCollection } from '../dal'; 3import { collectionKeys } from '../collectionKeys'; 4 5export default function useUpdateCollection() { 6 const queryClient = useQueryClient(); 7 8 const mutation = useMutation({ 9 mutationFn: (collection: { 10 collectionId: string; 11 rkey: string; 12 name: string; 13 description?: string; 14 }) => { 15 return updateCollection(collection); 16 }, 17 18 onSuccess: (variables) => { 19 queryClient.invalidateQueries({ 20 queryKey: collectionKeys.collection(variables.collectionId), 21 }); 22 queryClient.invalidateQueries({ 23 queryKey: collectionKeys.all(), 24 }); 25 }, 26 }); 27 28 return mutation; 29}