Hello.
I have this canActivate which checks if the recieved client id through a parameter really returns an existing client or not
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): any {
const client = route.params.client
return this.hrAgileService.getClientById(client)
.pipe(
map((res: any) => {
console.log('res', res)
GlobalSettings.currentClient = res.id
return !!res.id
}),
catchError((err: any) => {
this.router.navigateByUrl('/home')
return of(false)
})
)
}```
If it returns true (in this case !!res.id) is there a way to access this id from the component i'm going to?
Right now I'm just saving the id in a static variable in GlobalSettings class to retrieve it right away, but I'd like to avoid that.
Thanks!