debian-mirror-gitlab/app/assets/javascripts/frequent_items/store/index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
721 B
JavaScript
Raw Normal View History

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
};