Files
gridpilot.gg/apps/website/hooks/team/useTeamStandings.ts
2026-01-16 01:00:03 +01:00

22 lines
767 B
TypeScript

import { useQuery } from '@tanstack/react-query';
import { enhanceQueryResult } from '@/lib/di/hooks/useReactQueryWithApiError';
export function useTeamStandings(_teamId: string, leagues: string[]) {
const queryResult = useQuery({
queryKey: ['teamStandings', _teamId, leagues],
queryFn: async () => {
// For demo purposes, create mock standings
return leagues.map(leagueId => ({
leagueId,
leagueName: `League ${leagueId}`,
position: Math.floor(Math.random() * 10) + 1,
points: Math.floor(Math.random() * 100),
wins: Math.floor(Math.random() * 5),
racesCompleted: Math.floor(Math.random() * 10),
}));
},
enabled: leagues.length > 0,
});
return enhanceQueryResult(queryResult);
}