Created
August 14, 2013 07:03
-
-
Save onepixelsolid/6228640 to your computer and use it in GitHub Desktop.
This file contains 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
checkLoggedIn = (obj) -> | |
page = obj.page.defaultTemplate | |
if Meteor.loggingIn() | |
console.log 'Logging in' | |
if not Meteor.user() and page isnt 'login' | |
this.redirect('/login') | |
else | |
if Meteor.user() and page is 'login' | |
this.redirect('/') | |
Meteor.pages | |
"/": | |
to: "dashboard" | |
as: "root" | |
before: [checkLoggedIn] | |
"/login": | |
to: "login" | |
before: [checkLoggedIn] | |
"*": "404" | |
, | |
defaults: | |
layout: "layout" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment