2014-03-11 11:23:32 -05:00
|
|
|
var AuthenticatedRoute = Ember.Route.extend({
|
2014-05-14 18:36:13 -05:00
|
|
|
beforeModel: function () {
|
2014-05-09 00:00:10 -05:00
|
|
|
var user = this.container.lookup('user:current');
|
|
|
|
|
|
|
|
if (!user || !user.get('isSignedIn')) {
|
2014-05-14 18:36:13 -05:00
|
|
|
this.notifications.showError('Please sign in');
|
|
|
|
|
|
|
|
this.transitionTo('signin');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-03-11 11:23:32 -05:00
|
|
|
actions: {
|
|
|
|
error: function (error) {
|
2014-05-09 00:00:10 -05:00
|
|
|
if (error.jqXHR && error.jqXHR.status === 401) {
|
2014-03-09 22:44:08 -05:00
|
|
|
this.transitionTo('signin');
|
2014-03-11 11:23:32 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default AuthenticatedRoute;
|