Closed AmitMY closed 3 years ago
Would allowing you to return your own UrlTree
be sufficient?
I believe it would be, yes.
For now, instead of using urls, i'm using:
const redirectUnauthorizedToLogin = (route: ActivatedRouteSnapshot) => {
const path = route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/');
const params = route.queryParams;
return pipe(
loggedIn,
tap((isLoggedIn) => {
if (!isLoggedIn) {
console.log('Saving afterLogin');
sessionStorage.setItem('afterLogin', JSON.stringify({path, params}));
}
}),
map(loggedIn => loggedIn || ['/'])
);
};
Isn't this issue a duplicate of #2144?
Anyways, I'm currently attempting to introduce a fix for this issue by allowing the consumer to specify a UrlTree
to the pipes.
@EdricChan03 any luck :) ?
Version info
Angular: ~9.0.0-rc.7
Firebase: ^7.6.1-0
AngularFire: ^5.3.0-rc.4
Using the
AngularFireAuthGuard
works, but does not support redirect with query parameters. When a user isn't authenticated, I'd like to direct them to login, and once they are logged in send them back to where they tried to access.But I can't redirect to this url as its not a valid segment, and
redirectUnauthorizedTo
doesn't support query parameters