snort/packages/app/src/Element/LogoutButton.tsx

22 lines
478 B
TypeScript
Raw Normal View History

2023-01-26 11:34:18 +00:00
import { useDispatch } from "react-redux";
2023-02-08 21:10:26 +00:00
import { FormattedMessage } from "react-intl";
2023-01-26 11:34:18 +00:00
import { logout } from "State/Login";
2023-02-08 21:10:26 +00:00
import messages from "./messages";
export default function LogoutButton() {
const dispatch = useDispatch();
2023-01-26 11:34:18 +00:00
return (
<button
className="secondary"
type="button"
onClick={() => {
dispatch(logout());
window.location.href = "/";
2023-02-09 12:26:54 +00:00
}}>
2023-02-08 21:10:26 +00:00
<FormattedMessage {...messages.Logout} />
2023-01-26 11:34:18 +00:00
</button>
);
2023-01-26 11:34:18 +00:00
}