Currently, I am working on mastering RxJS
. Within my project, there are 3 API calls that need to be made. Specifically, I must execute the 2nd API call and then pass its data as a parameter to the 3rd API call. My attempt at achieving this functionality is outlined below:
checkPermission(permissionName: string): Observable<boolean> {
this.check(this.p1)
.pipe(
switchMap(res => {
const shouldCheck = res.Value;
if (shouldCheck.toLowerCase() === 'true') {
return this.checkPermission(permissionName).pipe(
map(result => {
return result;
})
);
} else return of(true);
})
)
.subscribe(permission => {
});
}
Unfortunately, I encountered a syntax error while testing this implementation.