Files
gridpilot.gg/apps/website/hooks/league/useLeagueSchedule.ts
2026-01-06 19:36:03 +01:00

17 lines
567 B
TypeScript

import { useQuery } from '@tanstack/react-query';
import { useInject } from '@/lib/di/hooks/useInject';
import { LEAGUE_SERVICE_TOKEN } from '@/lib/di/tokens';
import { enhanceQueryResult } from '@/lib/di/hooks/useReactQueryWithApiError';
export function useLeagueSchedule(leagueId: string) {
const leagueService = useInject(LEAGUE_SERVICE_TOKEN);
const queryResult = useQuery({
queryKey: ['leagueSchedule', leagueId],
queryFn: () => leagueService.getLeagueSchedule(leagueId),
enabled: !!leagueId,
});
return enhanceQueryResult(queryResult);
}