refactor: move file download logic
parent
4f8156874d
commit
3f3e83c13a
|
@ -851,15 +851,11 @@ export default {
|
|||
await this.deleteFromViewWithAnimation(delIds, updatedDays);
|
||||
},
|
||||
|
||||
/** Download the selected files */
|
||||
async downloadSelection() {
|
||||
if (this.selection.size === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get files to download
|
||||
const fileInfos = await dav.getFiles([...this.selection].map(p => p.fileid));
|
||||
await dav.downloadFiles(fileInfos.map(f => f.filename));
|
||||
/**
|
||||
* Download the currently selected files
|
||||
*/
|
||||
downloadSelection() {
|
||||
dav.downloadFilesByIds([...this.selection].map(p => p.fileid));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -171,3 +171,17 @@ export async function deleteFile(path) {
|
|||
)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the files given by the fileIds
|
||||
* @param {number[]} fileIds
|
||||
*/
|
||||
export async function downloadFilesByIds(fileIds) {
|
||||
if (fileIds.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get files to download
|
||||
const fileInfos = await getFiles(fileIds);
|
||||
await downloadFiles(fileInfos.map(f => f.filename));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue