I have set up a data subscription that I want to utilize through piping, but for some reason it's not working as expected. The error message I'm receiving is:
The property pipe is not available for type "OperatorFunction<unknown, [unknown, boolean, any]>"
This is the code snippet in question:
auth.service
authenticationState = new BehaviorSubject(false);
checkToken() {
this.storage.get(TOKEN_KEY).then(access => {
if (access) {
this.user = this.helper.decodeToken(access);
this.authenticationState.next(true);
}
});
The issue arises in page.ts
when trying to use the pipe method:
ngOnInit() {
this.subscription = combineLatest (
this.authService.authenticationState,
from(this.storage.get(USER_ID)))
.pipe(
switchMap(
([isAuthenticated, id]) => isAuthenticated
? this.userService.getUserDetails(id)
: of(null)
)
).subscribe(result => {
if (result) {
this.information = result;
console.log(this.information);
} else {
}
},
error => {}
);
}