Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.