Hello!
Trying to make an authorization in a server-like-app approach and cant cope with transition.
I have the configuration similar to this topic author.
App.Router.map(function() {
this.route('login', { path: '/' });
this.route('home');
this.route('settings');
this.route('help');
});
App.HomeRoute = Ember.Route.extend({
redirect: function() {
if (!App.User.loggedIn) {
this.transitionTo('login');
}
}
});
When I am actually logged in and trying to access / route, it must redirect me to another default route (let it be āhomeā to clarify). I can do it using transitionTo in the same way
App.LoginRoute = Ember.Route.extend({
redirect: function() {
if (App.User.loggedIn) {
this.transitionTo('home');
}
}
});
The problem is that after this I can press the ābackā button and it will transit me to the login route again. Its okay because I will be redirected to home immediately but it seems like a dead loop.
User never could back to the page he came from. So scaringā¦