I'm doing a series of file uploads using HTML5 API and I want to run a collection of Promises in succession and only do a final PUT when all files are uploaded.
Currently, this is what I have:
obj.attachments.forEach( (file) => {                                                              
  const request = fetch(`${window.location.origin}/api/cases/${obj.id}/attachment`, {             
    ...baseSettings,                                                                               
    body: file,                                                                                    
    headers: {},                                                                                   
  }).then((req) => req.json())                                                                     
    .then((json) => { console.log('upload ', json); });                                            
});                                                                                                
const request = fetch(`${window.location.origin}/api/cases`, putJSON(_.omit(obj, 'attachments')));
request.then((req) => req.json())                                                                  
       .then((json) => dispatch(receiveCase(json)));                                               
Ideally, the obj.attachments would be transformed into a collection of Promises and the final fetch could be appended and they would all run in succession. 
