update router for admin page

This commit is contained in:
yamanq 2016-08-25 22:02:23 -04:00
parent e2a38adee2
commit 9c63a46409

View File

@ -47,13 +47,24 @@ Router.route('/profile', {
});
Router.route('/admin', function() {
if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) {
waitOn: function() {
if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) {
return [
Meteor.subscribe('classes',this.params._id),
Meteor.subscribe('schools',this.params._id),
Meteor.subscribe('work',this.params._id),
Meteor.subscribe('requests',this.params._id),
Meteor.subscribe('users',this.params._id)
];
} else {
this.render('NotFound');
}
},
action: function() {
this.render("admin");
} else {
this.redirect('/login');
}
});
Router.configure({
notFoundTemplate: "NotFound"
});
});