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

export const fetchInMemoriam = async () => {
  try {
    const data: PostGetRanking = await queryClient.fetchQuery({
      queryKey: rankingQueryKeys.getInMemoriam(),
      queryFn: () => rankingApi.getInMemoriam().then((res) => res.data),
      gcTime: 0,
      staleTime: 0
    });

    return data;
  } catch (error) {
    console.error('Failed to fetch in-memoriam data:', error);
  }
};
