Created
February 26, 2019 15:45
-
-
Save hwillson/7b4c5e2452f3c703359e665a41dfad15 to your computer and use it in GitHub Desktop.
Apollo Client - 2.5.0 - Resolver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const client = new ApolloClient({ | |
cache: new InMemoryCache(), | |
link: new HttpLink({ | |
uri: 'http://localhost:4000/graphql', | |
}), | |
resolvers: { | |
Launch: { | |
isInCart: (launch, _args, { cache }) => { | |
const { cartItems } = cache.readQuery({ | |
query: GET_CART_ITEMS | |
}); | |
return cartItems.includes(launch.id); | |
}, | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment