0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/routes/settings/index.js

27 lines
907 B
JavaScript
Raw Normal View History

import MobileIndexRoute from 'ghost/routes/mobile-index-route';
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
import mobileQuery from 'ghost/utils/mobile';
var SettingsIndexRoute = MobileIndexRoute.extend(SimpleAuth.AuthenticatedRouteMixin, CurrentUserSettings, {
// Redirect users without permission to view settings,
// and show the settings.general route unless the user
// is mobile
beforeModel: function () {
var self = this;
return this.currentUser()
.then(this.transitionAuthor())
.then(this.transitionEditor())
.then(function () {
if (!mobileQuery.matches) {
self.transitionTo('settings.general');
}
});
},
desktopTransition: function () {
this.transitionTo('settings.general');
}
});
export default SettingsIndexRoute;