2021-09-04 21:26:38 +02:00
|
|
|
import AbstractService from './abstractService'
|
|
|
|
import {downloadBlob} from '../helpers/downloadBlob'
|
|
|
|
|
|
|
|
export default class DataExportService extends AbstractService {
|
|
|
|
request(password) {
|
|
|
|
return this.post('/user/export/request', {password: password})
|
|
|
|
}
|
|
|
|
|
|
|
|
download(password) {
|
2021-09-08 17:33:58 +02:00
|
|
|
const clear = this.setLoading()
|
2021-09-04 21:26:38 +02:00
|
|
|
return this.getBlobUrl('/user/export/download', 'POST', {password})
|
|
|
|
.then(url => downloadBlob(url, 'vikunja-export.zip'))
|
2021-09-08 17:33:58 +02:00
|
|
|
.finally(() => clear())
|
2021-09-04 21:26:38 +02:00
|
|
|
}
|
|
|
|
}
|