Version 9b #1
|
|
@ -88,9 +88,45 @@ export const api = {
|
|||
insightPipeline: () => req('/insights/pipeline',{method:'POST'}),
|
||||
listInsights: () => req('/insights'),
|
||||
latestInsights: () => req('/insights/latest'),
|
||||
exportZip: () => window.open(`${BASE}/export/zip`),
|
||||
exportJson: () => window.open(`${BASE}/export/json`),
|
||||
exportCsv: () => window.open(`${BASE}/export/csv`),
|
||||
exportZip: async () => {
|
||||
const res = await fetch(`${BASE}/export/zip`, {headers: hdrs()})
|
||||
if (!res.ok) throw new Error('Export failed')
|
||||
const blob = await res.blob()
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = `mitai-export-${new Date().toISOString().split('T')[0]}.zip`
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
window.URL.revokeObjectURL(url)
|
||||
},
|
||||
exportJson: async () => {
|
||||
const res = await fetch(`${BASE}/export/json`, {headers: hdrs()})
|
||||
if (!res.ok) throw new Error('Export failed')
|
||||
const blob = await res.blob()
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = `mitai-export-${new Date().toISOString().split('T')[0]}.json`
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
window.URL.revokeObjectURL(url)
|
||||
},
|
||||
exportCsv: async () => {
|
||||
const res = await fetch(`${BASE}/export/csv`, {headers: hdrs()})
|
||||
if (!res.ok) throw new Error('Export failed')
|
||||
const blob = await res.blob()
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = `mitai-export-${new Date().toISOString().split('T')[0]}.csv`
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
window.URL.revokeObjectURL(url)
|
||||
},
|
||||
|
||||
// Admin
|
||||
adminListProfiles: () => req('/admin/profiles'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user