import { useMutation } from '@tanstack/react-query';

import { fixersQueryKeys } from '../fixers-query-keys';
import { type PostEditFixer, fixersApi } from '../fixers-api';

import type { BaseAxiosError } from '../../../../types';
import { ResponseType } from '@api/response-type';

export const usePostEditFixerMutation = () => {
  return useMutation<ResponseType, BaseAxiosError, PostEditFixer, ResponseType>({
    mutationKey: fixersQueryKeys.editFixer(),
    mutationFn: async (data) => {
      const response = await fixersApi.editFixer(data);
      return response.data;
    }
  });
};
