Browse Source

Add missing await for Promise.all

main
anthony 4 years ago
parent
commit
da7a48dc63
  1. 3
      index.js

3
index.js

@ -11,6 +11,7 @@ async function fetch3CatFacts() {
const uri = `${CAT_API_ENDPOINT}/facts/random?amount=${CAT_FACTS_COUNT}`;
try {
const response = await axios.get(uri);
console.log()
return response.data.map(rep => rep.text);
} catch {
return null;
@ -49,7 +50,7 @@ async function fetchDaysOfPerCountry(country) {
app.post('/', async (req, _res) => {
const countryCode = req.body?.countryCode;
const [foxPicture, catFacts, holidays] = Promise.all([
const [foxPicture, catFacts, holidays] = await Promise.all([
fetchFowImage(),
fetch3CatFacts(),
fetchDaysOfPerCountry(countryCode)

Loading…
Cancel
Save