Last active
August 31, 2015 17:11
-
-
Save btbjosh/58fed60ec61cc4e775fc to your computer and use it in GitHub Desktop.
Route file for Meteor w/ Flow Router (w/ Roles)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ROUTER GROUPS | |
var exposed, loggedIn, admin; | |
exposed = FlowRouter.group({}); | |
loggedIn = FlowRouter.group({ | |
triggersEnter: [ | |
function(){ | |
$('html, body').animate({ scrollTop: -10000 }, 100); // scroll to top on route change | |
} | |
] | |
}); | |
admin = loggedIn.group({ | |
prefix: '/admin', | |
triggersEnter: [ | |
function(context, redirect) { | |
if (Meteor.user() && !Roles.userIsInRole(Meteor.user(), 'admin')) { | |
redirect('/'); | |
} | |
} | |
] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment