@empathyco/x-components
Version:
Empathy X Components
49 lines (46 loc) • 1.28 kB
JavaScript
import { setQuery } from '../../../store/utils/query.utils.js';
import { urlParams } from './getters/url-params.getter.js';
import { initialUrlState } from './initial-state.js';
import { setParams } from './mutations/set-params.mutation.js';
/**
* {@link XStoreModule} For the URL module.
*
* @internal
*/
const urlXStoreModule = {
state: () => ({
...initialUrlState,
initialExtraParams: {},
}),
getters: {
urlParams,
},
mutations: {
setParams,
setQuery,
setRelatedTags(state, relatedTags) {
state.tag = relatedTags.map(relatedTag => relatedTag.tag);
},
setPrompt(state, prompt) {
state.prompt = prompt;
},
setFilters(state, newFilters) {
state.filter = newFilters.map(filter => filter.id);
},
setPage(state, page) {
state.page = page;
},
setSort(state, sort) {
state.sort = sort;
},
setInitialExtraParams(state, extraParams) {
state.initialExtraParams = extraParams;
},
setScroll(state, scroll) {
state.scroll = scroll;
},
},
actions: {},
};
export { urlXStoreModule };
//# sourceMappingURL=module.js.map