Wait for all files upload to complete with Promise.all
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Thu, 7 Mar 2019 13:19:45 +0000 (14:19 +0100)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Thu, 7 Mar 2019 13:19:45 +0000 (14:19 +0100)
Feature #14910

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

src/common/webdav.ts

index 1a7da835c82a02c9ffaf3f2a524b3aea0cfd762e..aef97c8cf05ede7587fcce266256e22d0536d607 100644 (file)
@@ -29,11 +29,13 @@ export class WebDAV {
         })
 
     upload = (url: string, path: string, files: File[], config: WebDAVRequestConfig = {}) => {
-        return files.map(file => this.request({
-            ...config, url,
-            method: 'PUT',
-            data: file
-        }));
+        return Promise.all(
+            files.map(file => this.request({
+                ...config, url,
+                method: 'PUT',
+                data: file
+            }))
+        );
     }
 
     copy = (url: string, destination: string, config: WebDAVRequestConfig = {}) =>