(path: string)
| 8 | } |
| 9 | |
| 10 | export async function apiGet<T>(path: string): Promise<T> { |
| 11 | const res = await fetch(`${BASE_URL}${path}`, { |
| 12 | headers: authHeaders(), |
| 13 | }); |
| 14 | if (!res.ok) throw new Error(await res.text()); |
| 15 | return res.json(); |
| 16 | } |
| 17 | |
| 18 | export async function apiPost<T>(path: string, body?: any): Promise<T> { |
| 19 | const res = await fetch(`${BASE_URL}${path}`, { |
no test coverage detected