(path: string)
| 145 | } |
| 146 | |
| 147 | export async function del<T = boolean>(path: string): Promise<T> { |
| 148 | const resp = await fetch(`${_baseUrl}${path}`, { |
| 149 | method: 'DELETE', |
| 150 | headers: getAuthHeaders(), |
| 151 | }) |
| 152 | handle401(resp) |
| 153 | if (!resp.ok) { |
| 154 | const text = await resp.text().catch(() => '') |
| 155 | throw new Error(`HTTP ${resp.status}: ${text}`) |
| 156 | } |
| 157 | return resp.json() as Promise<T> |
| 158 | } |
| 159 | |
| 160 | export async function put<T>(path: string, body?: unknown): Promise<T> { |
| 161 | const hasBody = body !== undefined |
no test coverage detected