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

import { rankingQueryKeys } from '../ranking-query-keys';
import { type PostGetRanking, rankingApi } from '../ranking-api';

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

export const useGetFullRanking = () => {
  return useQuery<PostGetRanking, BaseAxiosError>({
    queryKey: rankingQueryKeys.getFullRanking(),
    queryFn: async () => {
      const response = await rankingApi.getFullRanking();
      return response.data;
    },
    gcTime: 0,
    staleTime: 0,
  });
};
