add selected download notification

This commit is contained in:
myl7 2021-11-28 21:26:20 +08:00
parent e706051238
commit 1b74a378e9
No known key found for this signature in database
GPG key ID: 04F1013B67177C88

View file

@ -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.')
})
}
}