mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-03 02:47:12 +00:00
fixed vue apollo
This commit is contained in:
parent
68326a6c9b
commit
3893e191ed
@ -1,7 +0,0 @@
|
||||
export default async function ({ isServer, apolloProvider }) {
|
||||
if (isServer) {
|
||||
const ensureReady = apolloProvider.collect()
|
||||
console.log('Call ensureReady!', ensureReady())
|
||||
await ensureReady()
|
||||
}
|
||||
}
|
@ -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' }
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user