Fixed admin page not waiting

This commit is contained in:
Kenneth Jao 2016-09-06 00:27:30 -04:00
parent 09e6afd10b
commit 1d66a88ef1

View File

@ -58,7 +58,7 @@ Router.route('/user/:email', {
} }
}); });
Router.route('/admin', { /*Router.route('/admin', {
waitOn: function() { waitOn: function() {
if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) { if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) {
return [ return [
@ -75,6 +75,25 @@ Router.route('/admin', {
action: function() { action: function() {
this.render("admin"); this.render("admin");
} }
});*/
Router.route('/admin', {
waitOn: function() {
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)
];
},
action: function() {
if (!Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) {
this.render("NotFound");
} else {
this.render("admin");
}
}
}); });
Router.configure({ Router.configure({