Looking to retrieve data from two APIs in Angular 8.
I have created a resolver like this:
export class AccessLevelResolve implements Resolve<any>{
constructor(private accessLevel: AccessLevelService) { }
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> {
let id = +route.paramMap.get('id');
const getControllerList = this.accessLevel.getAll().pipe(
map(
res => {
if (res) {
return res.date;
}
}
)
)
const getRoleAccessRole = this.accessLevel.getAllWithId(id).pipe(
map(
res => {
if (res) {
return res.date;
}
}
)
)
return forkJoin(getControllerList, getRoleAccessRole).subscribe(res => {
return {
controllerList: res[0],
accessRoleList: res[1]
}
}
)
}
However, I am encountering the following error:
Type 'Subscription' is missing the following properties from type 'Observable': _isScalar, source, operator, lift, and 6 more.
What could be causing this issue? How should I go about resolving it?