fixed vue apollo

This commit is contained in:
SVogel 2017-07-26 11:27:59 +02:00
parent 68326a6c9b
commit 3893e191ed
4 changed files with 4 additions and 12 deletions

View File

@ -1,7 +0,0 @@
export default async function ({ isServer, apolloProvider }) {
if (isServer) {
const ensureReady = apolloProvider.collect()
console.log('Call ensureReady!', ensureReady())
await ensureReady()
}
}

View File

@ -2,9 +2,6 @@ module.exports = {
build: {
vendor: ['vue-apollo', 'apollo-client']
},
router: {
middleware: 'apollo'
},
plugins: [
// Will inject the plugin in the $root app and also in the context as `apolloProvider`
{ src: '~plugins/apollo.js', injectAs: 'apolloProvider' }

View File

@ -6,7 +6,7 @@
"vue-apollo": "^2.1.0-beta.2"
},
"scripts": {
"dev": "node server.js",
"dev": "nuxt",
"build": "nuxt build",
"start": "cross-env NODE_ENV=production node server.js"
}

View File

@ -3,7 +3,6 @@ import Vue from 'vue'
import VueApollo from 'vue-apollo'
import { ApolloClient, createNetworkInterface } from 'apollo-client'
Vue.use(VueApollo)
const API_ENDPOINT = 'https://api.graph.cool/simple/v1/cj1dqiyvqqnmj0113yuqamkuu'
@ -18,4 +17,7 @@ const apolloProvider = new VueApollo({
defaultClient: apolloClient
})
Vue.use(VueApollo)
Vue.mixin({apolloProvider})
export default apolloProvider