I've the following code
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
this.userStore$ = this.store.pipe(select('userStore'));
return this.userStore$.pipe(
map( res => {
if(res) return true
}))
}
At first time res is undefined, so the canActivate resolves itself returning false. What i need is to mantain it listening until res is valorized, and then return true to proceed to the route. How i can do it? Thanks.