Created
November 3, 2016 14:13
-
-
Save planetexpress69/2f0bf925fe468a1d3c5ac9adde61fd6a to your computer and use it in GitHub Desktop.
session.attemptedTransition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Route (AuthenticatedRouteMixin) | |
init: function() { | |
this._super(...arguments); | |
}, | |
beforeModel(transition) { | |
if (!this.get('session.isAuthenticated')) { | |
let authenticationRoute = "login"; | |
this.set('session.attemptedTransition', transition); | |
Ember.Logger.info(this.get('session')); // <== session contains the attempteTransition | |
return this.transitionTo(authenticationRoute); | |
} else { | |
return this._super(...arguments); | |
} | |
}, | |
//Login controller | |
authenticate() { | |
let {identification, password} = this.getProperties('identification', 'password'); | |
var _this = this; | |
this.get('session').authenticate('authenticator:oauth2', identification, password).then((response) => { | |
Ember.Logger.info(_this.get('session.attemptedTransition')); // <== null :-( | |
this.transitionToRoute('index.index'); | |
}) | |
.catch((reason) => { | |
this.set('errorMessage', reason.error_description || reason); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment