Add Paddock Briefing UI (Phase 21)

This commit is contained in:
2026-05-25 13:04:29 -04:00
parent 3bd169c55c
commit 7ce2b1ace4
6 changed files with 177 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
import type { LiveStateResponse, Meeting, RaceHub, Weekend } from './types'
import type { LiveStateResponse, Meeting, NewsItem, RaceHub, Weekend } from './types'
export async function fetchRaceHub(sessionKey: number): Promise<RaceHub> {
const res = await fetch(`/api/v1/race-hub?session_key=${sessionKey}`)
@@ -41,3 +41,18 @@ export async function fetchLiveState(): Promise<LiveStateResponse> {
}
return res.json()
}
export async function fetchNews(limit?: number, source?: string): Promise<NewsItem[]> {
const params = new URLSearchParams()
if (limit) params.set('limit', limit.toString())
if (source) params.set('source', source)
const query = params.toString()
const url = query ? `/api/v1/news?${query}` : '/api/v1/news'
const res = await fetch(url)
if (!res.ok) {
throw new Error(`API ${res.status}: ${res.statusText}`)
}
return res.json()
}