Created
September 21, 2018 07:26
-
-
Save sultaniman/e0dfa3aaa2bf95d4916fd6aa1fca10d8 to your computer and use it in GitHub Desktop.
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
| import Vue from 'vue' | |
| import VueApollo from 'vue-apollo' | |
| import { ApolloClient } from 'apollo-client' | |
| import { HttpLink } from 'apollo-link-http' | |
| import { InMemoryCache } from 'apollo-cache-inmemory' | |
| import { GRAPHQL_ENDPOINT } from './config' | |
| const httpLink = new HttpLink({ | |
| // You should use an absolute URL here | |
| uri: GRAPHQL_ENDPOINT | |
| }) | |
| // Create the apollo client | |
| export const apolloClient = new ApolloClient({ | |
| link: httpLink, | |
| cache: new InMemoryCache(), | |
| connectToDevTools: true | |
| }) | |
| const apolloProvider = new VueApollo({ | |
| defaultClient: apolloClient | |
| }) | |
| // Install the vue plugin | |
| Vue.use(VueApollo) | |
| export default apolloProvider |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment