use-post-get-temp.tsx 543 B

1234567891011121314151617
  1. import { useQuery } from '@tanstack/react-query';
  2. import { photosQueryKeys } from '../photos-query-keys';
  3. import { photosApi, type PostGetTempReturn } from '../photos-api';
  4. import type { BaseAxiosError } from '../../../../types';
  5. export const useGetTempQuery = (token: string, enabled: boolean) => {
  6. return useQuery<PostGetTempReturn, BaseAxiosError>({
  7. queryKey: photosQueryKeys.getTemp(token),
  8. queryFn: async () => {
  9. const response = await photosApi.getTemp(token);
  10. return response.data;
  11. },
  12. enabled,
  13. });
  14. };