Fixes: Infinite logout loop
This commit is contained in:
@@ -8,8 +8,10 @@ type Props = {
|
|||||||
auth: AuthStore,
|
auth: AuthStore,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Home = observer((props: Props) => {
|
const Home = observer(({ auth }: Props) => {
|
||||||
if (props.auth.authenticated) return <Redirect to="/dashboard" />;
|
if (auth.authenticated) return <Redirect to="/dashboard" />;
|
||||||
|
auth.logout();
|
||||||
|
|
||||||
window.location.href = BASE_URL;
|
window.location.href = BASE_URL;
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import { observable, action, computed, autorunAsync } from 'mobx';
|
import { observable, action, computed, autorun } from 'mobx';
|
||||||
import invariant from 'invariant';
|
import invariant from 'invariant';
|
||||||
import Cookie from 'js-cookie';
|
import Cookie from 'js-cookie';
|
||||||
import { client } from 'utils/ApiClient';
|
import { client } from 'utils/ApiClient';
|
||||||
@@ -87,7 +87,7 @@ class AuthStore {
|
|||||||
this.token = data.token;
|
this.token = data.token;
|
||||||
this.oauthState = data.oauthState;
|
this.oauthState = data.oauthState;
|
||||||
|
|
||||||
autorunAsync(() => {
|
autorun(() => {
|
||||||
localStorage.setItem(AUTH_STORE, this.asJson);
|
localStorage.setItem(AUTH_STORE, this.asJson);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user