+
+ const createZip = (fileUrls: string[], download: string[]) => {
+ const zip = new JSZip();
+ let id = 1;
+ fileUrls.map((href: string) => {
+ axios.get(href).then(response => response).then(({ data }: any) => {
+ const splittedByDot = href.split('.');
+ if (splittedByDot[splittedByDot.length - 1] !== 'json') {
+ if (fileUrls.length === id) {
+ zip.file(download[id-1], data);
+ zip.generateAsync({ type: 'blob' }).then((content) => {
+ FileSaver.saveAs(content, `download-${props.currentCollectionUuid}.zip`);
+ });
+ } else {
+ zip.file(download[id-1], data);
+ zip.generateAsync({ type: 'blob' });
+ }
+ } else {
+ zip.file(download[id-1], JSON.stringify(data));
+ zip.generateAsync({ type: 'blob' });
+ }
+ id++;
+ });
+ });
+ };
+
+ return props.href || props.kind === 'files'