(response: Response)
| 4 | const API_BASE = '/api'; |
| 5 | |
| 6 | async function parseJsonResponse<T>(response: Response): Promise<T> { |
| 7 | const contentType = response.headers.get('content-type'); |
| 8 | if (contentType && contentType.includes('application/json')) { |
| 9 | return response.json(); |
| 10 | } |
| 11 | // Fallback to text if not JSON |
| 12 | const text = await response.text(); |
| 13 | throw new ApiError(text || response.statusText, response.status, response.statusText); |
| 14 | } |
| 15 | |
| 16 | export async function fetchSources(): Promise<DataSource[]> { |
| 17 | try { |
nothing calls this directly
no outgoing calls
no test coverage detected