@empathyco/x-components
Version:
Empathy X Components
23 lines (21 loc) • 780 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
*/
const fetchAndSaveSemanticQuery = async ({ dispatch, commit }, request) => {
return dispatch('fetchSemanticQuery', request)
.then(response => {
commit('setSemanticQueries', response?.semanticQueries ?? []);
})
.catch(error => {
console.error(error);
});
};
export { fetchAndSaveSemanticQuery };
//# sourceMappingURL=fetch-and-save-semantic-query.action.js.map