I have create a web application using sails js. Following is logout function.
logout: function(req, res) {
req.session.destroy(function(err) {
res.redirect('/');
});
}
Sometime user does not logout from one click. But anyway user is redirecting to my home page. Then I have to click again logout button to logout the user.