bug: clear redux store on logout

closes #372
This commit is contained in:
Kieran 2023-02-28 19:33:47 +00:00
parent f30a9075a2
commit ac41f8c2f4
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
3 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,4 @@
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import { FormattedMessage } from "react-intl";
import { logout } from "State/Login";
@ -8,14 +7,13 @@ import messages from "./messages";
export default function LogoutButton() {
const dispatch = useDispatch();
const navigate = useNavigate();
return (
<button
className="secondary"
type="button"
onClick={() => {
dispatch(logout());
navigate("/");
window.location.href = "/";
}}>
<FormattedMessage {...messages.Logout} />
</button>

View File

@ -18,7 +18,7 @@ const SettingsIndex = () => {
function handleLogout() {
dispatch(logout());
navigate("/");
window.location.href = "/";
}
return (

View File

@ -447,7 +447,7 @@ const LoginSlice = createSlice({
},
logout: state => {
const relays = { ...state.relays };
Object.assign(state, InitState);
state = Object.assign(state, InitState);
state.loggedOut = true;
window.localStorage.clear();
state.relays = relays;