import { useMutation } from '@tanstack/react-query';
import { userApi, userQueryKeys, PostSetProfileDataReturn, PostSetProfileData } from '@api/user';

import type { BaseAxiosError } from '../../../../types';

export const usePostSetProfileMutation = () => {
  return useMutation<
    PostSetProfileDataReturn,
    BaseAxiosError,
    PostSetProfileData,
    PostSetProfileDataReturn
  >({
    mutationKey: userQueryKeys.setProfileData(),
    mutationFn: async (data) => {
      const response = await userApi.setProfileData(data);
      return response.data;
    }
  });
};
