First off lets just start with the fact that I am a complete noob with Meteor. Now that that is out of the way let the problem begin...
I have two pages, a splash page at '/' and a home page at '/home'. I am using iron-router for the routing. Now If I am not logged in and on the splash page and login I have it redirecting to the home page this works. Now if I close my browser and reopen and goto the '/' it loads for a few seconds then realizes that I am actually still logged in and then redirects me to '/home'.
My question is how to I get rid of this initial showing on the '/' when I am already logged in? I only want to show that page to people not signed in. Here is the code that I have in my router:
Router.configure({layoutTemplate: 'mainLayout'});
Router.map(function() {
this.route('splash', {path: '/'});
this.route('home');
});
var mustBeSignedIn = function(pause) {
if (!(Meteor.user() || Meteor.loggingIn())) {
Router.go('splash');
pause();
}
};
var goToDashboard = function(pause) {
if (Meteor.user()) {
Router.go('home');
pause();
}
};
Router.onBeforeAction(mustBeSignedIn, {except: ['splash']});
Router.onBeforeAction(goToDashboard, {only: ['splash']});
Hope this helps.
Using fast-render
might be a solution. Just run
mrt add fast-render
Check this great article on this topic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With