the canActivate route event accepts a boolean observable.
I want to return from the authService.getUser() the user object which is instantiated or null.
Depending on the user value I want to return true/false to the boolean observable.
How can I do this?
canActivate() : Observable<boolean>
{
let userObservable = this.authService.getUser();
userObservable.subscribe((user) => {
if (user == null) {
this.authService.startSigninMainWindow();
return false;
}
else
{
return true;
}
});
return new Observable<boolean>("I want to pass here the 'future' result of the userObservable");
}