Reset apollo cache on logout

This commit is contained in:
Christoph Lienhard 2021-02-07 17:01:06 +01:00
parent b26d6d6e69
commit 642062dff2
Signed by: christoph.lienhard
GPG Key ID: 6B98870DDC270884
1 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import Menu from "@material-ui/core/Menu";
import AccountCircle from "@material-ui/icons/AccountCircle";
import { makeStyles } from "@material-ui/core/styles";
import { useHistory } from "react-router-dom";
import { client } from "../backend/helper";
const useStyles = makeStyles({
menuButton: {
@ -26,7 +27,8 @@ function CustomAppBar(): React.ReactElement {
setAnchorEl(event.currentTarget);
};
const handleLogout = () => {
const handleLogout = async () => {
await client.resetStore();
localStorage.removeItem("token");
history.push("/login");
};