878c6ea9e1
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>
20 lines
No EOL
529 B
TypeScript
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()
|
|
}
|
|
}
|
|
} |