Ok, this is seriously making me lose my mind...
Promise.all([
one(code),
two(code),
three(code),
four(code),
five(code),
six(code),
seven(code) // <----- This one
]).then(data => {
// ...
}
The functions are nothing special...
function seven() {
return new Promise(function (resolve, reject) {
fetch(`/api-route`)
.then(res => res.json())
.then(data => {
if (data) {
resolve(data);
} else {
reject({
status: "Retrieval failed."
});
}
});
});
}
If I change the places of six() and seven(), then seven() works and six() no longer does... It makes no sense...
Calling the API routes manually works, but in the promise.all, they can't work after another? What am I missing?