Commit b88c1959 authored by peterhegman's avatar peterhegman

Move `Vuex.Store` call out of module

Also add `namespaced: true` to module
parent b87d9c0f
import Vue from 'vue';
import Vuex from 'vuex';
import App from './components/app.vue';
import { createStore } from '~/vuex_shared/modules/members';
import membersModule from '~/vuex_shared/modules/members';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
export default el => {
......@@ -13,10 +13,12 @@ export default el => {
const { members, groupId, currentUserId } = el.dataset;
const store = createStore({
members: convertObjectPropsToCamelCase(JSON.parse(members), { deep: true }),
sourceId: parseInt(groupId, 10),
currentUserId: currentUserId ? parseInt(currentUserId, 10) : null,
const store = new Vuex.Store({
...membersModule({
members: convertObjectPropsToCamelCase(JSON.parse(members), { deep: true }),
sourceId: parseInt(groupId, 10),
currentUserId: currentUserId ? parseInt(currentUserId, 10) : null,
}),
});
return new Vue({
......
import Vuex from 'vuex';
import createState from './state';
export const createStore = initialState =>
new Vuex.Store({
state: createState(initialState),
});
export default initialState => ({
namespaced: true,
state: createState(initialState),
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment