From 9c63a46409d48a3869b405f1c54a4ee659e85974 Mon Sep 17 00:00:00 2001 From: yamanq Date: Thu, 25 Aug 2016 22:02:23 -0400 Subject: [PATCH] update router for admin page --- hourglass/lib/router.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/hourglass/lib/router.js b/hourglass/lib/router.js index b87e5ce..71a904f 100644 --- a/hourglass/lib/router.js +++ b/hourglass/lib/router.js @@ -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" -}); +}); \ No newline at end of file