(path: string, init?: ApiFetchInit)
| 102 | } |
| 103 | |
| 104 | export async function apiFetch<T>(path: string, init?: ApiFetchInit): Promise<T> { |
| 105 | const response = await apiResponse(path, init) |
| 106 | const text = await response.text() |
| 107 | if (response.status === 204 || text.length === 0) { |
| 108 | return undefined as T |
| 109 | } |
| 110 | |
| 111 | return JSON.parse(text) as T |
| 112 | } |
| 113 | |
| 114 | export async function apiFetchBlob(path: string, init?: ApiFetchInit): Promise<Blob> { |
| 115 | const response = await apiResponse(path, init) |
no test coverage detected