Currently, there is a method under development that retrieves a value from the API. What steps are needed to properly integrate Async/Await functionality into this process?
fetchAccountById(){
let accountName;
this.accountService.fetchData(`SELECT * FROM account WHERE accountId = ${ localStorage.getItem('accountId') } AND accountArchived = 0`).subscribe(async (res: account) => {
accountName = await res[0]['accountLastName'];
});
return accountName;
}
console.log(fetchAccountById()); //undefined