Last active
August 29, 2019 02:31
-
-
Save galiazzi/f0f7a7940d4c7b8c8a34a07859cc743a to your computer and use it in GitHub Desktop.
Vue apollo
This file contains 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-boost"; | |
Vue.use(VueApollo); | |
const token = ""; | |
const apolloClient = new ApolloClient({ | |
uri: "http://localhost:8000/graphql", | |
request: async operation => { | |
operation.setContext({ | |
headers: { | |
authorization: token | |
} | |
} | |
)} | |
}); | |
const apolloProvider = new VueApollo({ | |
defaultClient: apolloClient | |
}); | |
export default apolloProvider; |
This file contains 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 App from "./App.vue"; | |
import apolloProvider from "./apollo"; | |
Vue.config.productionTip = false; | |
new Vue({ | |
apolloProvider, | |
render: h => h(App) | |
}).$mount("#app"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment