Apollo-angular: Expose apollo-client resetStore() #FeatureRequest

Created on 21 Dec 2016  路  8Comments  路  Source: kamilkisiela/apollo-angular

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?

enhancement

Most helpful comment

@KeithGillette

Apollo.getClient().resetStore();

All 8 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miquelferrerllompart picture miquelferrerllompart  路  7Comments

patriknil90 picture patriknil90  路  7Comments

maplion picture maplion  路  4Comments

CaerusKaru picture CaerusKaru  路  3Comments

GlauberF picture GlauberF  路  6Comments