@empathyco/x-components
Version:
Empathy X Components
26 lines (24 loc) • 831 B
JavaScript
/**
* Default implementation for the {@link SemanticQueriesGetters.request} getter.
*
* @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic
* queries module.
* @param getters - Current {@link https://vuex.vuejs.org/guide/getters.html | getters} of the
* semantic queries' module.
* @returns The semantic queries request to fetch data from the API.
*
* @public
*/
const request = ({ params, totalResults, config: { threshold, maxItemsToRequest } }, { normalizedQuery }) => {
return normalizedQuery && totalResults <= threshold
? {
query: normalizedQuery,
extraParams: {
...params,
k: maxItemsToRequest,
},
}
: null;
};
export { request };
//# sourceMappingURL=request.getter.js.map