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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -