16 lines
567 B
TypeScript
16 lines
567 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { useInject } from '@/lib/di/hooks/useInject';
|
|
import { RACE_RESULTS_SERVICE_TOKEN } from '@/lib/di/tokens';
|
|
import { enhanceQueryResult } from '@/lib/di/hooks/useReactQueryWithApiError';
|
|
|
|
export function useRaceWithSOF(raceId: string) {
|
|
const raceResultsService = useInject(RACE_RESULTS_SERVICE_TOKEN);
|
|
|
|
const queryResult = useQuery({
|
|
queryKey: ['raceWithSOF', raceId],
|
|
queryFn: () => raceResultsService.getWithSOF(raceId),
|
|
enabled: !!raceId,
|
|
});
|
|
|
|
return enhanceQueryResult(queryResult);
|
|
} |