I have implemented the functionality where I am able to get the request and control the authorization of the page, I want to redirect to login page in case of false request.
public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
return this.authSer.isAuthenticated().pipe(map((response) => {
console.log('I ma here');
if (response.status === 200) {
return true;
} else {
console.log('Error getting data');
return false;
}
}), catchError((error) => of(false))
);
}
How can I route to the login page from here? I am using angular 6