2018-11-08 19:23:39 +05:30
|
|
|
import Vuex from 'vuex';
|
2021-06-08 01:23:25 +05:30
|
|
|
import { FREQUENT_ITEMS_DROPDOWNS } from '../constants';
|
2018-11-08 19:23:39 +05:30
|
|
|
import * as actions from './actions';
|
|
|
|
import * as getters from './getters';
|
|
|
|
import mutations from './mutations';
|
|
|
|
import state from './state';
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
export const createFrequentItemsModule = (initState = {}) => ({
|
|
|
|
namespaced: true,
|
|
|
|
actions,
|
|
|
|
getters,
|
|
|
|
mutations,
|
|
|
|
state: state(initState),
|
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
export const createStoreOptions = () => ({
|
|
|
|
modules: FREQUENT_ITEMS_DROPDOWNS.reduce(
|
|
|
|
(acc, { namespace, vuexModule }) =>
|
|
|
|
Object.assign(acc, {
|
|
|
|
[vuexModule]: createFrequentItemsModule({ dropdownType: namespace }),
|
|
|
|
}),
|
|
|
|
{},
|
|
|
|
),
|
|
|
|
});
|
|
|
|
|
|
|
|
export const createStore = () => {
|
|
|
|
return new Vuex.Store(createStoreOptions());
|
2021-02-22 17:27:13 +05:30
|
|
|
};
|