Hello,
I wanted to give the current rc-4 a spin but don't understand how to access the plugin instance inside of Vuex.
plugins/apolloClient.js
import { ApolloClient, createNetworkInterface } from 'apollo-client'
import { getTokenFromStorage } from '../util/auth-helpers'
import 'isomorphic-fetch'
export default ({app, store}) => {
const networkInterface = createNetworkInterface({
uri: API_ENDPOINT,
transportBatching: true
})
const apolloOptions = {
networkInterface,
dataIdFromObject: r => r.id
}
const apolloClient = new ApolloClient(apolloOptions)
app.apolloClient = apolloClient
return apolloClient
}
Inside of my store/index.js
import apolloClient from '~/plugins/apolloClient.js'
(...)
export const actions = {
someAction(){
(...)
apolloClient.query(SOME_QUERY) // => does not work.. query not defined
}
}
How is it possible to access the plugin instance or maybe even {app.apolloClient} inside of Vuex now? Thanks
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1175">#c1175</a>)</em></sub></div>