diff options
Diffstat (limited to 'app/assets/javascripts/members/index.js')
-rw-r--r-- | app/assets/javascripts/members/index.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/assets/javascripts/members/index.js b/app/assets/javascripts/members/index.js new file mode 100644 index 00000000000..bd80bb2485b --- /dev/null +++ b/app/assets/javascripts/members/index.js @@ -0,0 +1,43 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; +import { GlToast } from '@gitlab/ui'; +import { parseDataAttributes } from 'ee_else_ce/members/utils'; +import App from './components/app.vue'; +import membersStore from './store'; + +export const initMembersApp = ( + el, + { + tableFields = [], + tableAttrs = {}, + tableSortableFields = [], + requestFormatter = () => {}, + filteredSearchBar = { show: false }, + }, +) => { + if (!el) { + return () => {}; + } + + Vue.use(Vuex); + Vue.use(GlToast); + + const store = new Vuex.Store( + membersStore({ + ...parseDataAttributes(el), + currentUserId: gon.current_user_id || null, + tableFields, + tableAttrs, + tableSortableFields, + requestFormatter, + filteredSearchBar, + }), + ); + + return new Vue({ + el, + components: { App }, + store, + render: (createElement) => createElement('app'), + }); +}; |