vikunja-frontend/src/services/dataExport.ts
Dominik Pschenitschni 878c6ea9e1 chore: make const out of export download file name (#2436)
Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2436
Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
2022-09-28 13:28:45 +00:00

20 lines
No EOL
529 B
TypeScript

import AbstractService from './abstractService'
import {downloadBlob} from '../helpers/downloadBlob'
const DOWNLOAD_NAME = 'vikunja-export.zip'
export default class DataExportService extends AbstractService {
request(password: string) {
return this.post('/user/export/request', {password})
}
async download(password: string) {
const clear = this.setLoading()
try {
const url = await this.getBlobUrl('/user/export/download', 'POST', {password})
downloadBlob(url, DOWNLOAD_NAME)
} finally {
clear()
}
}
}