Open daboudii opened 4 years ago
1- Remove all data from localstorage. 2- Navigate to: https://tomastrajan.github.io/angular-ngrx-material-starter#/examples/authenticated 3- No component/route is loaded after
Redirect to /example or /about page.
/example
/about
Something like this could fix the issue
export class AuthGuardService implements CanActivate { constructor(private store: Store<AppState>, private router: Router) {} canActivate(): Observable<boolean> { this.store.pipe(select(selectIsAuthenticated)).subscribe(isAuth => { if (isAuth) { return true; } else { this.router.navigateByUrl('/'); return false; } }) return this.store.pipe(select(selectIsAuthenticated)); } }
[x] Yes (Assistance is provided if you need help submitting a pull request) [ ] No
Minimal reproduction of the bug with instructions:
1- Remove all data from localstorage. 2- Navigate to: https://tomastrajan.github.io/angular-ngrx-material-starter#/examples/authenticated 3- No component/route is loaded after
Expected behavior:
Redirect to
/example
or/about
page.Other information:
Something like this could fix the issue
I would be willing to submit a PR to fix this issue:
[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No