filemanager: Integrate download and extract logic

This commit is contained in:
Johannes Zellner
2023-06-20 15:21:58 +02:00
parent 299e40c389
commit 5814793dc1
4 changed files with 21 additions and 5 deletions
+8
View File
@@ -84,6 +84,14 @@ export function createDirectoryModel(origin, accessToken, api) {
.send({ action: 'chown', uid: uid, recursive: true })
.query({ access_token: accessToken });
},
async extract(path) {
await superagent.put(`${origin}/api/v1/${api}/files/${path}`)
.send({ action: 'extract' })
.query({ access_token: accessToken });
},
async download(path) {
window.open(`${origin}/api/v1/${api}/files/${path}?download=true&access_token=${accessToken}`);
},
async save(filePath, content) {
const file = new File([content], 'file');
await superagent.post(`${origin}/api/v1/${api}/files/${filePath}`)