22 lines
589 B
TypeScript
22 lines
589 B
TypeScript
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
import {
|
|
getEventJoinedInfiniteQueryKey,
|
|
getEventListInfiniteQueryKey,
|
|
postEventJoinMutation,
|
|
} from '@/client/@tanstack/react-query.gen';
|
|
|
|
export function useJoinEvent() {
|
|
const queryClient = useQueryClient();
|
|
return useMutation({
|
|
...postEventJoinMutation(),
|
|
onSuccess: () => {
|
|
void queryClient.invalidateQueries({
|
|
queryKey: getEventListInfiniteQueryKey(),
|
|
});
|
|
void queryClient.invalidateQueries({
|
|
queryKey: getEventJoinedInfiniteQueryKey(),
|
|
});
|
|
},
|
|
});
|
|
}
|