@@ -1,8 +1,21 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { postEventJoinMutation } from '@/client/@tanstack/react-query.gen';
|
||||
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(),
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user