Updated UI

This commit is contained in:
2026-06-22 01:54:52 -04:00
parent 4300ebc532
commit 8fe35b820a
7 changed files with 464 additions and 168 deletions

View File

@@ -2,6 +2,14 @@ export const BASE = import.meta.env.DEV ? 'http://10.69.5.23:3000' : ''
export type DataRow = Record<string, number | string | null>
export async function fetchDaily(start?: string, end?: string): Promise<DataRow[]> {
const params = new URLSearchParams()
if (start) params.set('start', start)
if (end) params.set('end', end)
const res = await fetch(`/api/daily?${params}`)
return res.json()
}
async function get<T>(path: string, params: Record<string, string> = {}): Promise<T> {
const url = new URL(`${BASE}${path}`, window.location.origin)
Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v))