Fill cells in a table via API call

Hi everyone, I am trying to fill the last column in the table with a value I get back from a rest api call which takes the other columns as input.

The async and re-triggering isn't really working and the queries fail back to back... I am not a pro in Javascript...

My App

In short in each row, the price has to be filled and here is my code and I am triggering this script via the button.

async function runQuery(i) {

  const allData = table1.data;
  allData[i].price = 'Getting rates...';
  table1.setData(allData);  
  
  const quotes = await new Promise((resolve) => { 
    Get_Quote_API_Request.trigger({
      additionalScope: { i: i },
      onSuccess: function (returnData) {
        const allData = table1.data;
        allData[i].price = returnData.priceResult[0].freightPrice;
        table1.setData(allData);              
        resolve(returnData);
        runQuery(i + 1);
      },
      onFailure: function (returnData) {
        const allData = table1.data;
        allData[i].price = "Error...";
        table1.setData(allData);        
        resolve(returnData);
        runQuery(i + 1);
      }      
    });
  }); 
  
}

runQuery(0);

I think the code worked, the problem was that the API was set to timeout 10000 which I changed and it worked as the response was taking time. I removed the async and Promise...