This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/services/dataExport.ts
Dominik Pschenitschni 878c6ea9e1
Some checks failed
continuous-integration/drone/push Build is failing
chore: make const out of export download file name (#2436)
Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: #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
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()
}
}
}