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