use-post-unjoin-event.tsx 598 B

1234567891011121314151617
  1. import { useMutation } from '@tanstack/react-query';
  2. import { eventsQueryKeys } from '../events-query-keys';
  3. import { type PostJoinEvent, eventsApi } from '../events-api';
  4. import type { BaseAxiosError } from '../../../../types';
  5. import { ResponseType } from '@api/response-type';
  6. export const usePostUnjoinEventMutation = () => {
  7. return useMutation<ResponseType, BaseAxiosError, PostJoinEvent, ResponseType>({
  8. mutationKey: eventsQueryKeys.unjoinEvent(),
  9. mutationFn: async (data) => {
  10. const response = await eventsApi.unjoinEvent(data);
  11. return response.data;
  12. }
  13. });
  14. };