score:1

Accepted answer
var vehiclesT = asset.assetIDs;
  if(!asset.assetIDs){
    vehiclesT = [];
  }
  var y;
  var vehicles = [];
  for(y=0; y< vehiclesT.length; y++){
    var url = 'api/assetName/?vid='+vehiclesT[y]+'&id='+id;
    fetch(url, {credentials: 'include', method: 'get'}).then(function(body){
      return body.text();
    }).then(function(data) {
      vehicles.push(data);
      console.log(vehicles);
      if(y == vehiclesT.length - 1){
        vehicles = vehicles.map(function(vehiclef, index){
          return(
            <li key={index}>{vehiclef}</li>
          )
        });
      }
    });
  }

Related Query

More Query from same tag