diff --git a/src/public/js/app.js b/src/public/js/app.js index a11b3ae..3f441aa 100644 --- a/src/public/js/app.js +++ b/src/public/js/app.js @@ -89,7 +89,7 @@ const loginCheck = function(nextState, replace, next, f) { // Let's check if the user has a token, if he does let's assume he's logged // in. If that's not the case he will be logged out on the fisrt query - if (token !== "") { + if (token && token !== "") { store.dispatch({ type: 'USER_SET_TOKEN', payload: { @@ -98,7 +98,7 @@ const loginCheck = function(nextState, replace, next, f) { }); } - if (!isLogged && token === "") { + if (!isLogged && (!token || token === "")) { replace('/users/login'); } else { f(); @@ -126,6 +126,11 @@ const routes = { { path: '/users/logout', onEnter: function(nextState, replace, next) { + // Stop polling + if (pollingTorrentsId !== null) { + clearInterval(pollingTorrentsId); + pollingTorrentsId = null; + } store.dispatch(actionCreators.userLogout()); replace('/users/login'); next();