I'm am learning firebase to implement with my angular projects but running in to a issue with the .switchMap() operator. My understanding is that it is supposed to get one observable and switch to another. I am trying to get firebase user and switch to a authenticated application user.
Error: AngularFireObject<{}> is not assignable to the parm of type (value: User, index: Number)
Here is my code
AuthGuard :
canActivate(): Observable<boolean>{
return this.auth.user$
.switchMap(user => this.userService.get(user.uid)) <-- error
.map(appUser => appUser.isAdmin)
}
UserService:
get(uid:string){
return this.db.object('/users/' + uid);
}
Thanks