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: async () => {
        const response = await rankingApi.getInMemoriam();
        return response.data;
      },
      gcTime: 0,
      staleTime: 0
    });

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