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

import { photosQueryKeys } from '../photos-query-keys';
import { photosApi, type PostGetTempReturn } from '../photos-api';

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

export const useGetTempQuery = (token: string, enabled: boolean) => {
  return useQuery<PostGetTempReturn, BaseAxiosError>({
    queryKey: photosQueryKeys.getTemp(token),
    queryFn: async () => {
      const response = await photosApi.getTemp(token);
      return response.data;
    },
    enabled,
  });
};
