Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be consistent about SSR canActivate route guards #1810

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Conversation

NoelLH
Copy link
Contributor

@NoelLH NoelLH commented Dec 23, 2024

In all cases where Identity local tokens are needed, pass the decision to the browser

In all cases where Identity local tokens are needed, pass
the decision to the browser
@NoelLH NoelLH self-assigned this Dec 23, 2024
path: 'logout',
pathMatch: 'full',
canActivate: [
async () => {
inject(IdentityService).logout();
await inject(Router).navigate(['/'], {replaceUrl: true});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced direct navigation with a URL tree return, having read at angular/angular#56691 (comment) that

Navigating inside a guard is not recommended. you should return an URL tree of the boolean.

@NoelLH NoelLH requested a review from dorota-joanna December 23, 2024 18:20
@NoelLH NoelLH merged commit 9d851d0 into develop Dec 24, 2024
4 checks passed
@NoelLH NoelLH deleted the route-guard-fixes branch December 24, 2024 10:59
Copy link
Contributor

@dorota-joanna dorota-joanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants