I'm trying to clear the whole apollo cache on logout. However this is a little bit tough since Angular2Apollo neither does pass down function apollo-client.resetStore(), nor the apollo.client is accessible, since it is private.
Would it not make sense to either make apollo.client public or pass down resetStore and every other apollo-client functionality?
Is ApolloClient.resetStore() indeed supported in Apollo-Angular?
I don't see the method defined in the Apollo.d.ts TypeScript and when I attempt to call Apollo.resetStore() from Apollo-Angular 0.13.0 per the recommendations in the Apollo-Angular documentation, I get Apollo.resetStore is not a function.
@KeithGillette
Apollo.getClient().resetStore();
@kamilkisiela I'm trying that code but it get Property 'getClient' does not exist on type 'typeof Apollo', where should I import Apollo from, right now Im doing
import { Apollo } from "apollo-angular";
The following works for me:
import { Apollo } from 'apollo-angular';
Apollo.getClient().resetStore();
Which version of apollo-angular are you using @KeithGillette ? That code doesn't work for me, I'm on 0.13.0
I am using:
"apollo-angular": "0.13.0",
"apollo-client": "1.1.1",
"typescript": "2.3.2"
In the current version it's:
import { Apollo } from 'apollo-angular';
constructor(public apollo: Apollo);
anyfunction() {
this.apollo.getClient().resetStore();
}
hope to save someone a bit time, as the example from KeithGilette isnt' working (anymore)
Yes, I meant an instance of Apollo service
Most helpful comment
@KeithGillette