In my testing this fixes the redirect loop on logout

This commit is contained in:
Tom Moor committed 2018-02-12 22:44:43 -08:00
1 parent 8ebf748cf6
commit ea471b2a19
5 files changed
+6 -8

No files matched your search

-1
View File
@@ -51,7 +51,6 @@ const Auth = ({ children }: Props) => {
}
stores.auth.logout();
window.location.href = BASE_URL;
return null;
};
-1
View File
@@ -30,7 +30,6 @@ class AccountMenu extends Component {
handleLogout = () => {
this.props.auth.logout();
window.location.href = BASE_URL;
};
handleFeedback = () => {
-2
View File
@@ -11,8 +11,6 @@ type Props = {
const Home = observer(({ auth }: Props) => {
if (auth.authenticated) return <Redirect to="/dashboard" />;
auth.logout();
window.location.href = BASE_URL;
return null;
});
+6 -3
View File
@@ -42,17 +42,20 @@ class AuthStore {
this.user = res.data.user;
this.team = res.data.team;
});
} catch (e) {
} catch (err) {
// Failure to update user info is a non-fatal error.
console.error(err);
}
};
@action
logout = () => {
logout = async () => {
this.user = null;
this.token = null;
localForage.clear();
Cookie.remove('loggedIn', { path: '/' });
await localForage.clear();
window.location.href = BASE_URL;
};
@action
-1
View File
@@ -67,7 +67,6 @@ class ApiClient {
// Handle 401, log out user
if (response.status === 401) {
stores.auth.logout();
window.location = '/';
return;
}