UNPKG

@empathyco/x-components

Version:
23 lines (20 loc) 874 B
import { localStorageService } from '../../../../utils/storage.js'; /** * Default implementation for the {@link HistoryQueriesActions.setHistoryQueries}. * * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions, * provided by Vuex. * @param historyQueries - The new history queries to save to the store and browser storage. * @public */ const setHistoryQueries = ({ commit, state, getters }, historyQueries) => { if (state.isEnabled) { if (historyQueries.length > state.config.maxItemsToStore) { historyQueries = historyQueries.slice(0, state.config.maxItemsToStore); } commit('setHistoryQueries', historyQueries); localStorageService.setItem(getters.storageKey, historyQueries); } }; export { setHistoryQueries }; //# sourceMappingURL=set-history-queries.action.js.map