use-post-update-photo.tsx 623 B

123456789101112131415161718192021
  1. import { useMutation } from '@tanstack/react-query';
  2. import { photosQueryKeys } from '../photos-query-keys';
  3. import { type PostSetSaveTempReturn, type PostSetUpdatePhoto, photosApi } from '../photos-api';
  4. import type { BaseAxiosError } from '../../../../types';
  5. export const usePostUpdatePhotoMutation = () => {
  6. return useMutation<
  7. PostSetSaveTempReturn,
  8. BaseAxiosError,
  9. PostSetUpdatePhoto,
  10. PostSetSaveTempReturn
  11. >({
  12. mutationKey: photosQueryKeys.updatePhoto(),
  13. mutationFn: async (data) => {
  14. const response = await photosApi.updatePhoto(data);
  15. return response.data;
  16. }
  17. });
  18. };