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

20 lines
529 B
TypeScript
Raw Permalink Normal View History

import AbstractService from './abstractService'
import {downloadBlob} from '../helpers/downloadBlob'
const DOWNLOAD_NAME = 'vikunja-export.zip'
export default class DataExportService extends AbstractService {
2022-06-23 01:20:07 +00:00
request(password: string) {
return this.post('/user/export/request', {password})
}
2022-06-23 01:20:07 +00:00
async download(password: string) {
2021-09-08 15:33:58 +00:00
const clear = this.setLoading()
try {
const url = await this.getBlobUrl('/user/export/download', 'POST', {password})
downloadBlob(url, DOWNLOAD_NAME)
} finally {
clear()
}
}
}