I need to run the code in a specific order; first the foreach loop should be executed, followed by a call to the getHistory() method. Your assistance is greatly appreciated.
const execute = async()=>{
await this.currentContent.forEach(async currentContent => {
if (!currentContent.footnote) {
let tempContent: any = await this._http.get(`VersionHistory/ContentAuditTrail/${currentContent.id}/${this.newDatetimeSelection}`).toPromise();
if (tempContent){
console.info('end time call : raw content');
currentContent.rawContent = tempContent.value;
}
// content.rawContent = await this._http.get(`VersionHistory/ContentAuditTrail/${c.id}/${this.oldDatetimeSelection}`).toPromise();
} else {
let newcontent: any = await this._http.get(`VersionHistory/ContentFootnoteAuditTrail/${currentContent.footnote.id}/${this.newDatetimeSelection}`).toPromise();
if (newcontent) {
console.info('end time call : footnote content');
currentContent.footnote.footnote = newcontent.value;
}
}
})
//setTimeout(() => {
console.info('end time call');
this.getHistory();
//}, 4000);
}
execute();