// In dev, Vite proxies /api → http://localhost:8000. // In the built container, FastAPI serves both /api and the static SPA. // So same-origin everywhere — no base URL needed. const BASE = ""; export async function apiGet(path: string, init?: RequestInit): Promise { const res = await fetch(`${BASE}${path}`, { ...init, headers: { Accept: "application/json", ...(init?.headers ?? {}) }, }); if (!res.ok) throw new Error(`${res.status} ${res.statusText}`); return (await res.json()) as T; } export interface StatusResponse { status: string; app: string; version: string; uptime_seconds: number; } export const getStatus = () => apiGet("/api/status");