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 Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import App from './components/app.vue'; 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'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
export default el => { export default el => {
...@@ -13,10 +13,12 @@ export default el => { ...@@ -13,10 +13,12 @@ export default el => {
const { members, groupId, currentUserId } = el.dataset; const { members, groupId, currentUserId } = el.dataset;
const store = createStore({ const store = new Vuex.Store({
members: convertObjectPropsToCamelCase(JSON.parse(members), { deep: true }), ...membersModule({
sourceId: parseInt(groupId, 10), members: convertObjectPropsToCamelCase(JSON.parse(members), { deep: true }),
currentUserId: currentUserId ? parseInt(currentUserId, 10) : null, sourceId: parseInt(groupId, 10),
currentUserId: currentUserId ? parseInt(currentUserId, 10) : null,
}),
}); });
return new Vue({ return new Vue({
......
import Vuex from 'vuex';
import createState from './state'; import createState from './state';
export const createStore = initialState => export default initialState => ({
new Vuex.Store({ namespaced: true,
state: createState(initialState), 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