From 1d66a88ef16bee45325940cba213eb5221efd84b Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 6 Sep 2016 00:27:30 -0400 Subject: [PATCH] Fixed admin page not waiting --- hourglass/lib/router.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/hourglass/lib/router.js b/hourglass/lib/router.js index 990478a..9932be0 100644 --- a/hourglass/lib/router.js +++ b/hourglass/lib/router.js @@ -58,7 +58,7 @@ Router.route('/user/:email', { } }); -Router.route('/admin', { +/*Router.route('/admin', { waitOn: function() { if (Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) { return [ @@ -75,6 +75,25 @@ Router.route('/admin', { action: function() { 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({