2021-07-02 11:07:36 -04:00
|
|
|
import Vue from 'vue';
|
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
|
|
|
import TokenAccess from './components/token_access.vue';
|
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
2021-11-01 08:11:46 -04:00
|
|
|
defaultClient: createDefaultClient(),
|
2021-07-02 11:07:36 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
export const initTokenAccess = (containerId = 'js-ci-token-access-app') => {
|
|
|
|
const containerEl = document.getElementById(containerId);
|
|
|
|
|
|
|
|
if (!containerEl) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { fullPath } = containerEl.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el: containerEl,
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
|
|
|
fullPath,
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(TokenAccess);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|