2
0

router.js 690 B

1234567891011121314151617181920212223242526272829
  1. Router.configure({
  2. loadingTemplate: 'spinner',
  3. notFoundTemplate: 'notfound',
  4. layoutTemplate: 'defaultLayout',
  5. onBeforeAction: function() {
  6. var options = this.route.options;
  7. // Redirect logged in users to Boards view when they try to open Login or
  8. // signup views.
  9. if (Meteor.userId() && options.redirectLoggedInUsers) {
  10. return this.redirect('Boards');
  11. }
  12. // Authenticated
  13. if (! Meteor.userId() && options.authenticated) {
  14. return this.redirect('atSignIn');
  15. }
  16. // Reset default sessions
  17. Session.set('error', false);
  18. Tracker.nonreactive(function() {
  19. EscapeActions.executeLowerThan(40);
  20. });
  21. this.next();
  22. }
  23. });