I have below code in which i want to call an await after getting response in .then
.
const info = new getInfo(this.fetchDetails);
info
.retrieve()
.then((res) => {
const details = this.getLatestInfo(res, 'John');
})
.catch((error) => {
console.log(error);
});
In nutshell want to make const details = this.getAgentInfo(res, 'John');
as const details = await this.getLatestInfo(res, 'John');
but its giving error as "await is only valid in async function", how to make this async?