debian-mirror-gitlab/app/assets/javascripts/crm/contacts_bundle.js

42 lines
962 B
JavaScript
Raw Normal View History

2022-01-26 12:08:38 +05:30
import { GlToast } from '@gitlab/ui';
2021-12-11 22:18:48 +05:30
import Vue from 'vue';
import VueApollo from 'vue-apollo';
2022-01-26 12:08:38 +05:30
import VueRouter from 'vue-router';
2021-12-11 22:18:48 +05:30
import createDefaultClient from '~/lib/graphql';
import CrmContactsRoot from './components/contacts_root.vue';
2022-01-26 12:08:38 +05:30
import routes from './routes';
2021-12-11 22:18:48 +05:30
Vue.use(VueApollo);
2022-01-26 12:08:38 +05:30
Vue.use(VueRouter);
Vue.use(GlToast);
2021-12-11 22:18:48 +05:30
export default () => {
const el = document.getElementById('js-crm-contacts-app');
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
if (!el) {
return false;
}
2022-01-26 12:08:38 +05:30
const { basePath, groupFullPath, groupIssuesPath, canAdminCrmContact, groupId } = el.dataset;
const router = new VueRouter({
base: basePath,
mode: 'history',
routes,
});
2021-12-11 22:18:48 +05:30
return new Vue({
el,
2022-01-26 12:08:38 +05:30
router,
2021-12-11 22:18:48 +05:30
apolloProvider,
2022-01-26 12:08:38 +05:30
provide: { groupFullPath, groupIssuesPath, canAdminCrmContact, groupId },
2021-12-11 22:18:48 +05:30
render(createElement) {
return createElement(CrmContactsRoot);
},
});
};