Fixes: Infinite logout loop

This commit is contained in:
Tom Moor committed 2017-11-11 14:42:29 -08:00
1 parent ef25d6f70c
commit 25b2b2a024
2 files changed
+6 -4

No files matched your search

+4 -2
View File
@@ -8,8 +8,10 @@ type Props = {
auth: AuthStore,
};
const Home = observer((props: Props) => {
if (props.auth.authenticated) return <Redirect to="/dashboard" />;
const Home = observer(({ auth }: Props) => {
if (auth.authenticated) return <Redirect to="/dashboard" />;
auth.logout();
window.location.href = BASE_URL;
return null;
});
+2 -2
View File
@@ -1,5 +1,5 @@
// @flow
import { observable, action, computed, autorunAsync } from 'mobx';
import { observable, action, computed, autorun } from 'mobx';
import invariant from 'invariant';
import Cookie from 'js-cookie';
import { client } from 'utils/ApiClient';
@@ -87,7 +87,7 @@ class AuthStore {
this.token = data.token;
this.oauthState = data.oauthState;
autorunAsync(() => {
autorun(() => {
localStorage.setItem(AUTH_STORE, this.asJson);
});
}