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