(cfg: Partial<HotConfig>)
| 52 | } |
| 53 | |
| 54 | export async function saveConfig(cfg: Partial<HotConfig>): Promise<SaveConfigResult> { |
| 55 | const res = await fetch('/api/config', { |
| 56 | method: 'POST', |
| 57 | headers: { 'Content-Type': 'application/json', ...getAuthHeader() }, |
| 58 | body: JSON.stringify(cfg), |
| 59 | }); |
| 60 | if (res.status === 401) { |
| 61 | const pinia = getActivePinia(); |
| 62 | if (pinia) useAuthStore(pinia).logout(); |
| 63 | throw new Error('HTTP 401'); |
| 64 | } |
| 65 | if (!res.ok) throw new Error(`HTTP ${res.status}`); |
| 66 | return res.json() as Promise<SaveConfigResult>; |
| 67 | } |
| 68 | |
| 69 | export interface RequestsPage { |
| 70 | summaries: RequestSummary[]; |
no test coverage detected