2020-09-11 20:08:44 -04:00
|
|
|
import Vue from 'vue';
|
2020-09-17 14:10:12 -04:00
|
|
|
import Vuex from 'vuex';
|
2020-10-12 05:08:38 -04:00
|
|
|
import { parseDataAttributes } from 'ee_else_ce/groups/members/utils';
|
2020-09-11 20:08:44 -04:00
|
|
|
import App from './components/app.vue';
|
2020-09-17 14:10:12 -04:00
|
|
|
import membersModule from '~/vuex_shared/modules/members';
|
2020-09-11 20:08:44 -04:00
|
|
|
|
2020-09-22 11:09:37 -04:00
|
|
|
export const initGroupMembersApp = (el, tableFields) => {
|
2020-09-11 20:08:44 -04:00
|
|
|
if (!el) {
|
|
|
|
return () => {};
|
|
|
|
}
|
|
|
|
|
2020-09-17 14:10:12 -04:00
|
|
|
Vue.use(Vuex);
|
|
|
|
|
|
|
|
const store = new Vuex.Store({
|
|
|
|
...membersModule({
|
2020-10-12 05:08:38 -04:00
|
|
|
...parseDataAttributes(el),
|
2020-09-17 14:10:12 -04:00
|
|
|
currentUserId: gon.current_user_id || null,
|
2020-09-22 11:09:37 -04:00
|
|
|
tableFields,
|
2020-09-17 14:10:12 -04:00
|
|
|
}),
|
|
|
|
});
|
|
|
|
|
2020-09-11 20:08:44 -04:00
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
components: { App },
|
2020-09-17 14:10:12 -04:00
|
|
|
store,
|
|
|
|
render: createElement => createElement('app'),
|
2020-09-11 20:08:44 -04:00
|
|
|
});
|
|
|
|
};
|