import { Context , Logger , } from '@vue-storefront/core' ; import { Category , CategorySearchQueryVariables } from '@vue-storefront/magento-api' ; import { UseCategorySearchFactory , useCategorySearchFactory } from '../../factories/useCategorySearchFactory' ; import { UseCategorySearch } from '../../types/composables' ; const factoryParams = { search : async ( context , params ) : Promise < Category [ ] > => { Logger . debug ( '[Magento]: Search for category using' , { params } ) ; const { filters } = params ; const { data } = await context . $magento . api . categorySearch ( { filters } ) ; Logger . debug ( '[Result]:' , { data } ) ; return data . categoryList ; } , } ; const useCategorySearch = useCategorySearchFactory < Category , CategorySearchQueryVariables > ( factoryParams ) ; export default useCategorySearch ;