1const axios = require('axios');
2
3const someFunction = () => {
4 return new Promise(resolve => {
5 setTimeout(() => resolve('222'), 100)
6 })
7}
8
9const requestsData = ['https://httpstat.us/200', 'https://httpstat.us/205', 'https://httpstat.us/306']
10const requestArr = requestsData.map(async data => {
11 let waitForThisData = await someFunction(data);
12 return axios.post(data)
13 .then(response => {})
14 .catch(error => console.log(error.toString()))
15});
16
17Promise.all(requestArr).then(() => {
18 console.log('resolved promise.all')
19})