Show download errors

old-stable24
Varun Patil 2022-10-28 14:22:27 -07:00
parent d703aef0d0
commit 8e0c2bc61b
1 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,7 @@
import * as base from "./base";
import { generateUrl } from "@nextcloud/router";
import { showError } from "@nextcloud/dialogs";
import { translate as t } from "@nextcloud/l10n";
/**
* Download a file
@ -46,5 +48,12 @@ export async function downloadFilesByIds(fileIds: number[]) {
// Get files to download
const fileInfos = await base.getFiles(fileIds);
if (fileInfos.length !== fileIds.length) {
showError(t("memories", "Failed to download some files."));
}
if (fileInfos.length === 0) {
return;
}
await downloadFiles(fileInfos.map((f) => f.filename));
}