Speed up championship hub loading

This commit is contained in:
2026-07-03 01:11:31 -04:00
parent c989aace10
commit 127628e4dd
6 changed files with 303 additions and 10 deletions

View File

@@ -62,7 +62,9 @@ export async function fetchWeekend(meetingKey: number): Promise<Weekend> {
}
export async function fetchChampionshipHub(year?: number): Promise<ChampionshipHub> {
const url = year ? `/api/v1/championship/hub?year=${year}` : '/api/v1/championship/hub'
const params = new URLSearchParams({ source: 'auto' })
if (year) params.set('year', year.toString())
const url = `/api/v1/championship/hub?${params.toString()}`
const res = await fetch(url)
if (!res.ok) {
throw new Error(`API ${res.status}: ${res.statusText}`)