parent
f30a9075a2
commit
ac41f8c2f4
@ -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>
|
||||
|
@ -18,7 +18,7 @@ const SettingsIndex = () => {
|
||||
|
||||
function handleLogout() {
|
||||
dispatch(logout());
|
||||
navigate("/");
|
||||
window.location.href = "/";
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user