From 1b74a378e96fc57fdb8e5a25d46b018b105ca4d3 Mon Sep 17 00:00:00 2001 From: myl7 Date: Sun, 28 Nov 2021 21:26:20 +0800 Subject: [PATCH] add selected download notification --- components/FileListing.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/FileListing.tsx b/components/FileListing.tsx index b224e23..3fba704 100644 --- a/components/FileListing.tsx +++ b/components/FileListing.tsx @@ -262,7 +262,16 @@ const FileListing: FunctionComponent<{ query?: ParsedUrlQuery }> = ({ query }) = el.remove() } else if (files.length > 1) { setTotalGenerating(true) - saveFiles(files, folder).then(() => setTotalGenerating(false)) + const toastId = toast.loading('Downloading selected files. This may be slow...') + saveFiles(files, folder).then(() => { + setTotalGenerating(false) + toast.dismiss(toastId) + toast.success('Finished to download selected files.') + }).catch(() => { + setTotalGenerating(false) + toast.dismiss(toastId) + toast.error('Failed to download selected files.') + }) } }