2021-10-04 14:01:12 +03:00
|
|
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
2021-10-06 17:29:15 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2021-10-04 14:01:12 +03:00
|
|
|
|
2021-10-06 17:29:15 +03:00
|
|
|
export default class offersRoute extends AuthenticatedRoute {
|
|
|
|
@service store;
|
|
|
|
@service feature;
|
|
|
|
|
2021-10-13 18:53:21 +03:00
|
|
|
queryParams = {
|
|
|
|
type: {refreshModel: true}
|
|
|
|
};
|
|
|
|
|
2021-10-06 17:29:15 +03:00
|
|
|
// redirect to posts screen if:
|
|
|
|
// - TODO: members is disabled?
|
|
|
|
// - logged in user isn't owner/admin
|
|
|
|
beforeModel() {
|
|
|
|
super.beforeModel(...arguments);
|
|
|
|
if (!this.session.user.isAdmin) {
|
|
|
|
return this.transitionTo('home');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
model(params) {
|
|
|
|
return this.controllerFor('offers').fetchOffersTask.perform(params);
|
|
|
|
}
|
|
|
|
|
|
|
|
// trigger a background load of members plus labels for filter dropdown
|
|
|
|
setupController() {
|
|
|
|
super.setupController(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
buildRouteInfoMetadata() {
|
|
|
|
return {
|
|
|
|
titleToken: 'Offers'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|