From 642062dff20652ca7941c3574aa2aa8f8a07d4e4 Mon Sep 17 00:00:00 2001 From: Christoph Lienhard Date: Sun, 7 Feb 2021 17:01:06 +0100 Subject: [PATCH] Reset apollo cache on logout --- redaktions-app/src/components/CustomAppBar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redaktions-app/src/components/CustomAppBar.tsx b/redaktions-app/src/components/CustomAppBar.tsx index 32ae2c3..6ca6780 100644 --- a/redaktions-app/src/components/CustomAppBar.tsx +++ b/redaktions-app/src/components/CustomAppBar.tsx @@ -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"); };