I am trying to upload multiple files to the server sequentially. Before the next iteration, I want the result of the first iteration. I have tried many solutions with RxJS especially with concatMap with no luck.
I ended up using async method and await each response, before going to the next iteration as shown below. I would be keen to see if it is possible to achieve with purely Rxjs.
async updateDoc(files: any) {
for (let i = 0; i < files.length; i++) {
let updatedDocObj = {
...document,
file: {
date: files[i].lastModified,
fileName: files[i].name,
},
};
const success = await this.myService.uploadMultipleFiles(
updatedDocObj,files[i]);
}
}