UNPKG

@empathyco/x-components

Version:
31 lines (28 loc) 1.17 kB
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(_, recommendations) { return recommendations.length > 0 ? DefaultResultsEnrichmentService.instance.fetchResults(recommendations) : []; }, onSuccess({ commit }, enrichmentResults) { commit('updateRecommendationsFromEnrichment', enrichmentResults); }, }); /** * Default implementation for {@link RecommendationsActions.fetchAndSaveRecommendationsEnrichment} * action. * * @public */ const fetchAndSaveRecommendationsEnrichment = fetchAndSave; /** * Default implementation for {@link RecommendationsActions.cancelFetchAndSaveRecommendationsEnrichment} * action. * * @public */ const cancelFetchAndSaveRecommendationsEnrichment = cancelPrevious; export { cancelFetchAndSaveRecommendationsEnrichment, fetchAndSaveRecommendationsEnrichment }; //# sourceMappingURL=fetch-and-save-recommendations-enrichment.action.js.map