javascript - Promise.all returns function -
i use async/await fetch api. so, i've 2 async function return result.json()
.
i add 2 promise in promise.all([])
, values returned 'function()'.
my code :
// load external users const externalusers = async () => { const result = await fetch(url); return result.json(); }; const localusers = async () => { const result = await users.alldocs({ include_docs: true }); return result.rows; }; promise.all([externalusers, localusers]).then(values => { console.log(values); // return (2) [function, function] });
i don't understand why. can me ?
thank community !
run functions in promise.all
. return promises settled , passed then
function.
promise.all([externalusers(), localusers()]).then(values => { console.log(values); });
Comments
Post a Comment