Reputation: 959
I'm am trying to make my router redirect to my home route upon logout but meteor continually returns me to the meteor generated login form instead. Am I doing something incorrectly?
This is my router:
Router.route('/', {
name: 'home'
});
Router.route('/logout', function(){
var self = this;
Meteor.logout(function(err){
if(err){
console.log('Error Logging out: '+ err);
}
self.redirect('/');
// Router.go('home'); (Also tried this and didn't work)
});
});
Upvotes: 1
Views: 626
Reputation: 959
Figured it out ... painfully obvious.
I've an ensureSignedIn
function that checks the logged in status and redirects to the login form. The logout
function was not included.
// LOGGED IN
Router.plugin('ensureSignedIn', {
except: ['home','logout']
});
Upvotes: 1
Reputation: 5013
I am also newbie in meteor. But the below code is works fine in my app. Hope it may help you a bit.
Router.route('home', {
path: '/'
});
// After logout redirect by
Router.go('home');
Upvotes: 0