censis-archive/obrand/obrand-admin/app/routes/application.js
2016-06-06 11:45:51 +01:00

19 lines
551 B
JavaScript

import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
const { service } = Ember.inject;
export default Ember.Route.extend(ApplicationRouteMixin, {
sessionAccount: service('session-account'),
_loadCurrentUser() {
return this.get('sessionAccount').loadCurrentUser();
},
beforeModel() {
return this._loadCurrentUser();
},
sessionAuthenticated() {
this._super(...arguments);
this._loadCurrentUser().catch(() => this.get('session').invalidate());
}
});