IO-1169 Download only images.

This commit is contained in:
Patrick Fic
2021-06-02 10:48:01 -07:00
parent b897795c27
commit 8427ea208b
3 changed files with 9 additions and 10 deletions

View File

@@ -14,11 +14,11 @@ export default function JobsDocumentsDownloadButton({
const [download, setDownload] = useState(null);
const imagesToDownload = [
...galleryImages.images.filter((image) => image.isSelected),
...galleryImages.other.filter((image) => image.isSelected),
// ...galleryImages.other.filter((image) => image.isSelected),
];
const handleDownload = () => {
logImEXEvent("jobs_documents_download");
axios
.post("/media/download", {
ids: imagesToDownload.map((_) => _.key),
@@ -27,12 +27,8 @@ export default function JobsDocumentsDownloadButton({
// window.open(r.data);
downloadAs(
r.data,
`${identifier || "images"}.zip`,
`${identifier || "documents"}.zip`,
(progressEvent) => {
const percentage = Math.round(
(progressEvent.loaded * 100) / progressEvent.total
);
console.log(progressEvent, percentage);
setDownload((currentDownloadState) => {
return {
downloaded: progressEvent.loaded || 0,