How do I turn the below function in a async function?
getHandledSheet(): void {
this.timesheetService.getAllTimesheets().subscribe({next: (response: TimeSheet[]) => {this.timesheetsHandled = response.filter(sheet => sheet.status == 'HANDLED') }})
}
As in Matthieu's answer but fixing the syntax errors:
const timesheetObservable = this.timesheetService.getAllTimesheets();
const timesheets = await firstValueFrom(timesheetObservable);
this.timesheetsHandled = timesheets.filter(sheet => sheet.status == 'HANDLED');