Title / Description
Code import { ApolloClient } from 'apollo-client' import { HttpLink } from 'apollo-link-http' import { ApolloLink, concat } from 'apollo-link' import { InMemoryCache } from 'apollo-cache-inmemory' import Vue from 'vue' import vSelect from 'vue-select' import VueApollo from 'vue-apollo' import App from './App.vue' import router from './router' import axios from './backend/vue-axios' import BootstrapVue from 'bootstrap-vue' import Config from './config.js' import './registerServiceWorker' import 'bootstrap/dist/css/bootstrap.css' import 'bootstrap-vue/dist/bootstrap-vue.css' Vue.config.productionTip = false Vue.use(BootstrapVue) Vue.component('v-select', vSelect) const httpLink = new HttpLink({ uri: Config.HTTP_LINK_URL }) const authMiddleware = new ApolloLink((operation, forward) => { operation.setContext({ headers: { "Authorization": "Bearer " + localStorage.token } }); return forward(operation); }) const apolloClient = new ApolloClient({ link: concat(authMiddleware, httpLink), cache: new InMemoryCache({ addTypename: false }), connectToDevTools: true }) Vue.use(VueApollo) const apolloProvider = new VueApollo({ defaultClient: apolloClient, defaultOptions: { $loadingKey: 'loading' } }) new Vue({ provide: apolloProvider.provide(), router, axios, render: h => h(App) }).$mount('#app')
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code