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

refactor(unauthenticated-route-mixin): Move redirection logic for thi… #1666

Merged

Conversation

geekygrappler
Copy link
Contributor

…s mixin into a function

…s mixin into a function

- simple the same thing as mainmatter#1655 does for authenticated-route-mixin
@public
*/
beforeModel() {
if (this.get('session').get('isAuthenticated')) {
const didRedirect = runIfAuthenticated(getOwner(this), () => {
Copy link
Member

Choose a reason for hiding this comment

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

Not something that needs to be fixed before this can be merged (it's in the other PR as well) but that we should clean up at some point: this variable doesn't really indicate whether there was a redirect in the callback but whether the session was authenticated or not - not a big deal but this makes following what's going on unnecessarily complicated.

Copy link
Collaborator

Choose a reason for hiding this comment

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

great point. A tuple might be appropriate for a future PR

const [didRedirect, reason] = runIfAuthenticated(...);

@marcoow marcoow merged commit d087d69 into mainmatter:master Aug 31, 2018
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.

3 participants