Spaces:
Runtime error
Runtime error
File size: 809 Bytes
d917c4e 30ac2fc d917c4e 30ac2fc d917c4e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import { apiFetch } from './client'
import type { Summary, Trends } from '@llm-router/shared'
export async function getSummary(month?: string): Promise<Summary> {
const params = new URLSearchParams()
if (month) params.set('month', month)
const query = params.toString()
const res = await apiFetch(`/v1/expense/summary${query ? `?${query}` : ''}`)
if (!res.ok) throw new Error('Failed to load summary')
return res.json() as Promise<Summary>
}
export async function getTrends(months = 6, month?: string): Promise<Trends> {
const params = new URLSearchParams({ months: String(months) })
if (month) params.set('month', month)
const res = await apiFetch(`/v1/expense/trends?${params.toString()}`)
if (!res.ok) throw new Error('Failed to load trends')
return res.json() as Promise<Trends>
}
|