Stop polling for torrents if the user logged out
This commit is contained in:
parent
7ccfce9136
commit
316a850eec
@ -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
|
// 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
|
// in. If that's not the case he will be logged out on the fisrt query
|
||||||
if (token !== "") {
|
if (token && token !== "") {
|
||||||
store.dispatch({
|
store.dispatch({
|
||||||
type: 'USER_SET_TOKEN',
|
type: 'USER_SET_TOKEN',
|
||||||
payload: {
|
payload: {
|
||||||
@ -98,7 +98,7 @@ const loginCheck = function(nextState, replace, next, f) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLogged && token === "") {
|
if (!isLogged && (!token || token === "")) {
|
||||||
replace('/users/login');
|
replace('/users/login');
|
||||||
} else {
|
} else {
|
||||||
f();
|
f();
|
||||||
@ -126,6 +126,11 @@ const routes = {
|
|||||||
{
|
{
|
||||||
path: '/users/logout',
|
path: '/users/logout',
|
||||||
onEnter: function(nextState, replace, next) {
|
onEnter: function(nextState, replace, next) {
|
||||||
|
// Stop polling
|
||||||
|
if (pollingTorrentsId !== null) {
|
||||||
|
clearInterval(pollingTorrentsId);
|
||||||
|
pollingTorrentsId = null;
|
||||||
|
}
|
||||||
store.dispatch(actionCreators.userLogout());
|
store.dispatch(actionCreators.userLogout());
|
||||||
replace('/users/login');
|
replace('/users/login');
|
||||||
next();
|
next();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user