Show download errors

old-stable24^2
Varun Patil 2022-10-28 14:22:27 -07:00
parent 2bda53240d
commit a463e82f83
1 changed files with 9 additions and 0 deletions

View File

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