I have the following code which reads from an array of image URLs in imagesList, it then fetches from these images and adds them to the myDropzone1 box. The problem is that images are being added I think in the order they are done fetching, and not in the order they are listed in the array.
A possible solution I can think of is to use async/await, but I am not sure how to apply that to this bit of code. Please help.
for (var i = 0; i < imagesList.length; i++) {
let name = imagesList[i];
name = name.substring(name.lastIndexOf('/') + 1);
fetch(imagesList[i])
.then(res => res.blob())
.then(blob => {
let file = new File([blob], name, blob);
myDropzone1.addFile(file);
});
}
Thanks.