Files
python-react/frontend/src/lib/api.ts
2026-02-20 14:00:43 +07:00

14 lines
331 B
TypeScript

const API_BASE = '/api'
export async function fetchHealth() {
const res = await fetch(`${API_BASE}/health`)
if (!res.ok) throw new Error('Health check failed')
return res.json()
}
export async function fetchRoot() {
const res = await fetch(API_BASE)
if (!res.ok) throw new Error('Request failed')
return res.json()
}