import Vue from 'vue'
import { ApolloClient } from 'apollo-client'
import { createHttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import VueApollo from 'vue-apollo'

//멑티 클라이언트 구성
//https://apollo.vuejs.org/guide/multiple-clients.html

Vue.use(VueApollo)

const httpLink = createHttpLink({
    uri: 'https://www.nemopai.com/graphql',
})

const link = httpLink 

const apolloClient = new ApolloClient({
    // Tells Apollo to use the link chain with the http link we set up.
    link,
    // Handles caching of results and mutations.
    cache: new InMemoryCache({ freezeResults: false }),
    // Useful if you have the Apollo DevTools installed in your browser.
    connectToDevTools: true
});

const apolloProvider = new VueApollo({
    defaultClient: apolloClient
});

export default apolloProvider;
