@empathyco/x-components
Version:
Empathy X Components
25 lines (23 loc) • 877 B
JavaScript
/**
* Default implementation for the {@link SemanticQueriesActions.fetchAndSaveSemanticQuery}.
*
* @param _context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,
* provided by Vuex.
* @param request - The semantic query request to make.
* @returns A Promise of a SemanticQueriesResponse when it fetches the queries.
*
* @public
*/
// eslint-disable-next-line max-len
const fetchAndSaveSemanticQuery = ({ dispatch, commit }, request) => {
return dispatch('fetchSemanticQuery', request)
.then(response => {
commit('setSemanticQueries', response?.semanticQueries ?? []);
})
.catch(error => {
// eslint-disable-next-line no-console
console.error(error);
});
};
export { fetchAndSaveSemanticQuery };
//# sourceMappingURL=fetch-and-save-semantic-query.action.js.map