(url: string, options?: RequestInit)
| 135 | const noop = () => () => {} |
| 136 | |
| 137 | async function fetchJson<T>(url: string, options?: RequestInit): Promise<T> { |
| 138 | const resp = await fetchWithAuth(url, options) |
| 139 | if (!resp.ok) { |
| 140 | const body = await resp.json().catch(() => ({})) |
| 141 | throw new Error((body as any)?.error || `HTTP ${resp.status}`) |
| 142 | } |
| 143 | return resp.json() |
| 144 | } |
| 145 | |
| 146 | return { |
| 147 | getConfig: () => fetchJson('/_web/automation/config'), |
no test coverage detected