Created
January 17, 2015 04:38
-
-
Save cryptoquick/b23f64eca3c445d705d4 to your computer and use it in GitHub Desktop.
Meteor: Route to home when the user isn't logged in.
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
Router.configure({ | |
onBeforeAction: function () { | |
if (!Meteor.userId()) { | |
var currentRoute = Router.current().route.getName() | |
if (currentRoute !== 'home') { | |
Router.go('/'); | |
} | |
} | |
this.next(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment