@empathyco/x-components
Version:
Empathy X Components
29 lines (26 loc) • 1.03 kB
JavaScript
import { DefaultResultsEnrichmentService } from '../../../../services/results-enrichment.service.js';
import { createFetchAndSaveActions } from '../../../../store/utils/fetch-and-save-action.utils.js';
const { fetchAndSave, cancelPrevious } = createFetchAndSaveActions({
async fetch(_, results) {
return results.length > 0 ? DefaultResultsEnrichmentService.instance.fetchResults(results) : [];
},
onSuccess({ commit }, enrichmentResults) {
commit('updateResultsFromEnrichment', enrichmentResults);
},
});
/**
* Default implementation for {@link SearchActions.fetchAndSaveResultsEnrichment}
* action.
*
* @public
*/
const fetchAndSaveResultsEnrichment = fetchAndSave;
/**
* Default implementation for {@link SearchActions.cancelFetchAndSaveResultsEnrichment}
* action.
*
* @public
*/
const cancelFetchAndSaveResultsEnrichment = cancelPrevious;
export { cancelFetchAndSaveResultsEnrichment, fetchAndSaveResultsEnrichment };
//# sourceMappingURL=fetch-and-save-results-enrichment.action.js.map