-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(auth-guard): add support for specifying a string
to redirect to
#2448
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
feat(auth-guard): add support for specifying a string
to redirect to
#2448
Conversation
Seems that I did not think through the EDIT: I've temporarily removed support for specifying a |
UrlTree
or a string
to redirect tostring
to redirect to
867478f
to
e5cb663
Compare
c6e9fab
to
cd67dd3
Compare
/cc @jamesdaniels Thoughts? It's been about a month now |
src/auth-guard/auth-guard.ts
Outdated
@@ -40,21 +40,23 @@ export class AngularFireAuthGuard implements CanActivate { | |||
return this.authState.pipe( | |||
take(1), | |||
authPipeFactory(next, state), | |||
map(can => typeof can == "boolean" ? can : this.router.createUrlTree(<any[]>can)) | |||
map(can => typeof can === 'boolean' ? can : | |||
Array.isArray(can) ? this.router.createUrlTree(can) : this.router.parseUrl(can) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a test for this new functionality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current tests don't seem to test much... I'll see what I can do.
Note: those suggestions would be relevant once @jamesdaniels confirms the feasibility of this approach |
I can't seem to rebase the changes - was the file updated in a recent commit? |
|
cd67dd3
to
9eeba6c
Compare
I've just fixed the conflicts locally. |
Until angular/angularfire#2448 is merged, query parameters can't currently be specified as arguments for `redirect*To` methods from the AngularFire auth guard module.
I'm good with this approach, UrlTree support would be great. |
I don't see any way for the user to pass in a |
Closes #2287
Closes #2144
Checklist
yarn install
,yarn test
run successfully? (yes/no; required)Description
This PR introduces the ability to specify a
UrlTree
or astring
to the return value of anAuthPipe
and includes this feature in the existingredirect*To
methods.Previously, as noted in #2287, it was not possible to specify additional extras that could be passed to
Router#createUrlTree
.Code sample
UrlTree
(not currently possible atm):// TODO