2021-09-30 23:02:18 +05:30
|
|
|
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-18 22:05:49 +05:30
|
|
|
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
|
2021-09-30 23:02:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|