Fix logout cleanup

This commit is contained in:
Douglas Barone 2021-01-12 10:04:40 -04:00
parent 14115749a8
commit 171bc5932e

View File

@ -97,12 +97,6 @@ export async function onLogin(apolloClient, token) {
// Manually call this when user log out
export async function onLogout(apolloClient) {
if (typeof localStorage !== 'undefined') {
localStorage.removeItem(AUTH_TOKEN)
}
if (apolloClient.wsClient) restartWebsockets(apolloClient.wsClient)
try {
await apolloClient.resetStore()
} catch (e) {
@ -110,6 +104,12 @@ export async function onLogout(apolloClient) {
console.log('%cError on cache reset (logout)', 'color: orange;', e.message)
}
if (apolloClient.wsClient) restartWebsockets(apolloClient.wsClient)
if (typeof localStorage !== 'undefined') {
localStorage.removeItem(AUTH_TOKEN)
}
await router.push('login')
}