debian-mirror-gitlab/app/assets/javascripts/admin/users/index.js

32 lines
853 B
JavaScript
Raw Normal View History

2021-02-22 17:27:13 +05:30
import Vue from 'vue';
2021-06-08 01:23:25 +05:30
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
2021-02-22 17:27:13 +05:30
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import AdminUsersApp from './components/app.vue';
2021-06-08 01:23:25 +05:30
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
});
2021-02-22 17:27:13 +05:30
2021-03-11 19:13:27 +05:30
export const initAdminUsersApp = (el = document.querySelector('#js-admin-users-app')) => {
2021-02-22 17:27:13 +05:30
if (!el) {
return false;
}
const { users, paths } = el.dataset;
return new Vue({
el,
2021-06-08 01:23:25 +05:30
apolloProvider,
2021-03-08 18:12:59 +05:30
render: (createElement) =>
2021-02-22 17:27:13 +05:30
createElement(AdminUsersApp, {
props: {
users: convertObjectPropsToCamelCase(JSON.parse(users), { deep: true }),
paths: convertObjectPropsToCamelCase(JSON.parse(paths)),
},
}),
});
2021-03-11 19:13:27 +05:30
};