I'm trying to call two API
, but these are called one after the other, hence i'm wasting time unnecessarily. How to call both at the same and help me save time.
this.data = await this.processService.workflowAPI1('activiti$requisitionandpo', 'COMPLETED').then((d: any) => {
return d;
})
this.APIresponse = await this.processService.workflowAPI(selected_actID).then((d: any) => {
console.log(d)
this.spinner.hide();
this.showTable = true;
return d;
})
Edit: Thank you for answering my question, I tried all your method, Provided all method works, but i'm facing issues while invoking
this.data
in each one. is it due to asynchronous problem?
this.data.forEach(element => {
element['properties'] = element.properties.map;
columns.forEach(column => {
if (column.header == 'PO Number') {
if (column.hasMulValue) {
column.value_list.forEach(value => {
var column_value = this.adminService.loadColumnValue(value, element);
if (column_value != null && column_value != '0') {
element['po_num'] = column_value;
}
})
}
}
})
// element1.po_num = element1.properties.map.aclrq_poNum
var x = new Date(element.properties.completionDate);
var y = new Date("Oct 18, 2020");
if ((element.taskType == "aclrq:PreparePo") && (x > y)) {
arraynew.push(element)
}
})
vendor.js:69393 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'forEach' of undefined
TypeError: Cannot read property 'forEach' of undefined