mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-07 19:56:18 -04:00
feat(#73): Adaptive Weekend shell and responsive navigation
Implemented by claude via .agents/dev dispatch.
This commit is contained in:
@@ -15,6 +15,7 @@ import type {
|
||||
Session,
|
||||
TrackOutline,
|
||||
Weekend,
|
||||
WeekendContext,
|
||||
} from './types'
|
||||
|
||||
export async function fetchRaceHub(sessionKey: number): Promise<RaceHub> {
|
||||
@@ -114,6 +115,24 @@ export async function fetchWeekend(meetingKey: number): Promise<Weekend> {
|
||||
return res.json()
|
||||
}
|
||||
|
||||
// fetchWeekendContext consumes the canonical /api/v1/weekend-context endpoint
|
||||
// (sibling backend story #72). It resolves to null when the endpoint is not yet
|
||||
// available (404 / server without the handler) so the Weekend page can fall back
|
||||
// to client-side derivation from existing endpoints. Any other HTTP error throws.
|
||||
export async function fetchWeekendContext(): Promise<WeekendContext | null> {
|
||||
let res: Response
|
||||
try {
|
||||
res = await fetch('/api/v1/weekend-context')
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
if (res.status === 404) return null
|
||||
if (!res.ok) {
|
||||
throw new Error(`API ${res.status}: ${res.statusText}`)
|
||||
}
|
||||
return res.json()
|
||||
}
|
||||
|
||||
export async function fetchChampionshipHub(year?: number): Promise<ChampionshipHub> {
|
||||
const params = new URLSearchParams({ source: 'auto' })
|
||||
if (year) params.set('year', year.toString())
|
||||
|
||||
Reference in New Issue
Block a user