0👍
✅
reader.readAsDataURL(anexo);
is asynchronous. The forEach
looping is synchronous. The axios.post
is happening before data is actually loaded.
One solution is to use a promise wrapper and for of iterator to wait
Something like https://codesandbox.io/embed/cranky-cherry-oxvhg
Source:stackexchange.com