Reputation: 1363
I'm trying to clear caches so I get data from new user, not one that logged out..
In documentation Apollo recommends clearStore()
, but it seems like it doesn't work..
I tried this way:
handleLogout = () => {
const { client } = this.props;
localStorage.clear();
client.clearStore().then(() => {
history.push('/login')
})
}
clearStore()
returns Promise so I did it this way, I tried also call the function but same thing
Upvotes: 3
Views: 5930
Reputation: 41
You can call the cache store and reset is using the below:
handleLogout = () => {
const { client } = this.props;
client.cache.reset().then(() => {
history.push('/login')
})
Upvotes: 4