From 2aeabd4be34217f10189fa6d62746cc8ea7f2c30 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Fri, 12 Aug 2022 20:54:25 +0200 Subject: [PATCH] fix: reset GQL cache on logout --- packages/web/src/components/AccountDropdownMenu/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/web/src/components/AccountDropdownMenu/index.tsx b/packages/web/src/components/AccountDropdownMenu/index.tsx index 449eab80..31ee564e 100644 --- a/packages/web/src/components/AccountDropdownMenu/index.tsx +++ b/packages/web/src/components/AccountDropdownMenu/index.tsx @@ -4,6 +4,7 @@ import MenuItem from '@mui/material/MenuItem'; import Menu, { MenuProps } from '@mui/material/Menu'; import { Link } from 'react-router-dom'; +import apolloClient from 'graphql/client'; import * as URLS from 'config/urls'; import useAuthentication from 'hooks/useAuthentication'; import useFormatMessage from 'hooks/useFormatMessage'; @@ -27,8 +28,10 @@ function AccountDropdownMenu(props: AccountDropdownMenuProps): React.ReactElemen id } = props - const logout = () => { + const logout = async () => { authentication.updateToken(''); + await apolloClient.clearStore(); + onClose(); navigate(URLS.LOGIN);