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})
|
|
|
|
}
|
|
|
|
|
2021-10-11 19:37:20 +02:00
|
|
|
async download(password) {
|
2021-09-08 17:33:58 +02:00
|
|
|
const clear = this.setLoading()
|
2021-10-11 19:37:20 +02:00
|
|
|
try {
|
|
|
|
const url = await this.getBlobUrl('/user/export/download', 'POST', {password})
|
|
|
|
downloadBlob(url, 'vikunja-export.zip')
|
|
|
|
} finally {
|
|
|
|
clear()
|
|
|
|
}
|
2021-09-04 21:26:38 +02:00
|
|
|
}
|
|
|
|
}
|