Ghost/ghost/admin/app/routes/members.js

36 lines
971 B
JavaScript
Raw Normal View History

2019-01-22 19:23:26 +03:00
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
import {inject as service} from '@ember/service';
export default class MembersRoute extends AuthenticatedRoute {
@service config;
2019-01-22 19:23:26 +03:00
queryParams = {
label: {refreshModel: true}
};
2019-01-22 19:23:26 +03:00
// redirect to posts screen if:
// - TODO: members is disabled?
// - logged in user isn't owner/admin
beforeModel() {
super.beforeModel(...arguments);
2019-01-22 19:23:26 +03:00
return this.session.user.then((user) => {
if (!user.isOwnerOrAdmin) {
return this.transitionTo('home');
2019-01-22 19:23:26 +03:00
}
});
}
// trigger a background load of members plus labels for filter dropdown
setupController(controller) {
super.setupController(...arguments);
controller.fetchMembersTask.perform();
controller.fetchLabelsTask.perform();
}
buildRouteInfoMetadata() {
return {
titleToken: 'Members'
};
2019-01-22 19:23:26 +03:00
}
}