Skip to content

Instantly share code, notes, and snippets.

@Streemo
Created October 25, 2014 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Streemo/5733764e1063cb9e23a7 to your computer and use it in GitHub Desktop.
Save Streemo/5733764e1063cb9e23a7 to your computer and use it in GitHub Desktop.
Router.configure({
layoutTemplate: 'ApplicationLayout',
notFoundTemplate: 'notFound',
yieldTemplates: {
'header': {to: 'heading'}
}
});
function requireLogin(pause){
if (!Meteor.userId()){
this.render('accessDenied')
pause();
}
}
Router.onBeforeAction(requireLogin, {only: ['submit']});
//When I go to the 'submit' route as a not-logged-in user, requireLogin is called
//and the if clause is satisfied, and accessDenied (a template) is rendered.
//I think pause() is preventing the layout from rendering... Any way to get around that?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment