diff options
Diffstat (limited to 'client/config/router.js')
-rw-r--r-- | client/config/router.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/client/config/router.js b/client/config/router.js new file mode 100644 index 00000000..c859013f --- /dev/null +++ b/client/config/router.js @@ -0,0 +1,28 @@ +Router.configure({ + loadingTemplate: 'spinner', + notFoundTemplate: 'notfound', + layoutTemplate: 'defaultLayout', + + onBeforeAction: function() { + var options = this.route.options; + + // Redirect logged in users to Boards view when they try to open Login or + // signup views. + if (Meteor.userId() && options.redirectLoggedInUsers) { + return this.redirect('Boards'); + } + + // Authenticated + if (! Meteor.userId() && options.authenticated) { + return this.redirect('atSignIn'); + } + + // Reset default sessions + Session.set('error', false); + Session.set('warning', false); + + Popup.close(); + + this.next(); + } +}); |