@empathyco/x-components
Version:
Empathy X Components
30 lines (27 loc) • 927 B
JavaScript
import { createFetchAndSaveActions } from '../../../../store/utils/fetch-and-save-action.utils.js';
const { fetchAndSave, cancelPrevious } = createFetchAndSaveActions({
async fetch({ dispatch }, request) {
return dispatch('fetchRelatedPrompts', request);
},
onSuccess({ commit }, relatedPrompts) {
if (relatedPrompts) {
commit('setRelatedPromptsProducts', relatedPrompts);
}
},
});
/**
* Default implementation for
* {@link RelatedPromptsActions.fetchAndSaveRelatedPrompts} action.
*
* @public
*/
const fetchAndSaveRelatedPrompts = fetchAndSave;
/**
* Default implementation for
* {@link RelatedPromptsActions.cancelFetchAndSaveRelatedPrompts} action.
*
* @public
*/
const cancelFetchAndSaveRelatedPrompts = cancelPrevious;
export { cancelFetchAndSaveRelatedPrompts, fetchAndSaveRelatedPrompts };
//# sourceMappingURL=fetch-and-save-related-prompts.action.js.map