Await function doesn't work for me, when the code reach to line 36 from call in line 22 (until this line everything work properly), the code jump to line 32 (doesn't execute lines (22-31)) , than go back to line 13 and return empty array.
Any idea what i am doing wrong?
/*1*/ async function getMatchesInfo(matches_ids_list){
/*2*/ let promises = [];
/*3*/ matches_ids_list.map((id) =>
/*4*/ promises.push(
/*5*/ axios.get(`${api_domain}/fixtures/${id}`, {
/*6*/ params: {
/*7*/ api_token: process.env.api_token,
/*8*/ },
/*9*/ })
/*10*/ )
/*11*/ );
/*12*/ let matches_info = await Promise.all(promises);
/*13*/ const matches_rel_info = await extractRelevantMatchData(matches_info);
/*14*/ return matches_rel_info
/*15*/ }
/*16*/
/*17*/
/*18*/ async function extractRelevantMatchData(matches_info) {
/*19*/ list = []
/*20*/ await matches_info.map( async (match_info) => {
/*21*/ const {time, id, localteam_id, visitorteam_id, venue_id}=match_info.data.data;
/*22*/ let stadium_info = await getStadiumName(venue_id)
/*23*/ list.push({
/*24*/ match_id: id,
/*25*/ date: time.starting_at.date.split('-').reverse().join('/'),
/*26*/ hour: time.starting_at.time.split(':').slice(0,2).join(':'),
/*27*/ host_team: localteam_id,
/*28*/ away_team: visitorteam_id,
/*29*/ stadium: stadium_info,
/*30*/ })
/*31*/ })
/*32*/ return list
/*33*/ }
/*34*/
/*35*/ async function getStadiumName(venue_id){
/*36*/ const venue_info = await axios.get(`${api_domain}/venues/${venue_id}`, {
/*37*/ params: {
/*38*/ api_token: process.env.api_token,
/*39*/ },
/*40*/ })
/*41*/ return venue_info.data.data.city + ',' + venue_info.data.data.name;
/*42*/ }
/*43*/
/*44*/ (async()=>{return await getMatchesInfo([1,2,3])})