Ghost/core/client/app/routes/settings/apps.js
Kevin Ansfield 42b25a00e3 Ensure settings routes redirect to /signin when not authenticated
closes #5412
- call this._super() in beforeModel hooks so that simple-auth can handle the transition before we hit any protected API endpoints
2015-06-17 00:24:01 +01:00

29 lines
779 B
JavaScript

import Ember from 'ember';
import AuthenticatedRoute from 'ghost/routes/authenticated';
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
import styleBody from 'ghost/mixins/style-body';
export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
titleToken: 'Apps',
classNames: ['settings-view-apps'],
config: Ember.inject.service(),
beforeModel: function (transition) {
this._super(transition);
if (!this.get('config.apps')) {
return this.transitionTo('settings.general');
}
return this.get('session.user')
.then(this.transitionAuthor())
.then(this.transitionEditor());
},
model: function () {
return this.store.find('app');
}
});