added export tests feature
This commit is contained in:
@@ -39,6 +39,20 @@ export const api = {
|
||||
return request('GET', `/schedule/week?${params.toString()}`)
|
||||
},
|
||||
getRerunTests: () => request('GET', '/tests/rerun'),
|
||||
|
||||
exportWindow: async (windowId) => {
|
||||
const params = new URLSearchParams({ window_id: windowId })
|
||||
const res = await fetch(`${BASE}/schedule/export?${params}`)
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({ detail: res.statusText }))
|
||||
throw new Error(err.detail || `HTTP ${res.status}`)
|
||||
}
|
||||
const blob = await res.blob()
|
||||
const disposition = res.headers.get('Content-Disposition') ?? ''
|
||||
const match = disposition.match(/filename="([^"]+)"/)
|
||||
const filename = match ? match[1] : 'tests.zip'
|
||||
return { blob, filename }
|
||||
},
|
||||
}
|
||||
|
||||
// Transform the flat items array from GET /api/schedule/week into the
|
||||
|
||||
Reference in New Issue
Block a user