use-post-get-in-memoriam.tsx 570 B

123456789101112131415161718
  1. import { rankingQueryKeys } from '../ranking-query-keys';
  2. import { type PostGetRanking, rankingApi } from '../ranking-api';
  3. import { queryClient } from 'src/utils/queryClient';
  4. export const fetchInMemoriam = async () => {
  5. try {
  6. const data: PostGetRanking = await queryClient.fetchQuery({
  7. queryKey: rankingQueryKeys.getInMemoriam(),
  8. queryFn: () => rankingApi.getInMemoriam().then((res) => res.data),
  9. gcTime: 0,
  10. staleTime: 0
  11. });
  12. return data;
  13. } catch (error) {
  14. console.error('Failed to fetch in-memoriam data:', error);
  15. }
  16. };