(path: string)
| 8 | } |
| 9 | |
| 10 | async function apiFetch<T>(path: string): Promise<T> { |
| 11 | const res = await fetch(path, { headers: getAuthHeader() }); |
| 12 | if (res.status === 401) { |
| 13 | const pinia = getActivePinia(); |
| 14 | if (pinia) useAuthStore(pinia).logout(); |
| 15 | throw new Error('HTTP 401'); |
| 16 | } |
| 17 | if (!res.ok) throw new Error(`HTTP ${res.status}`); |
| 18 | return res.json() as Promise<T>; |
| 19 | } |
| 20 | |
| 21 | export function fetchLogs(params?: { requestId?: string; since?: number }): Promise<LogEntry[]> { |
| 22 | const q = new URLSearchParams(); |
no test coverage detected