lin3s-sylius-shop-api-client
Version:
JavaScript client on top of SyliusShopApiPlugin to build integrations with ease.
18 lines (14 loc) • 529 B
JavaScript
import axios from 'axios';
import merge from 'lodash.merge';
import {channelParams, localeParams} from '../requestConfig';
export default config => ({slug, page = 1, limit = 10}) => {
return new Promise((resolve, reject) => {
const headers = merge(
channelParams(config),
localeParams(config),
);
axios.get(`${config.baseUrl}/shop-api/taxon-products-by-slug/${slug}?page=${page}&limit=${limit}`, headers)
.then(response => resolve(response.data))
.catch(error => reject(error));
});
};