Implement shop search and refactor

This commit is contained in:
Almira Krdzic
2018-10-17 00:36:19 +02:00
parent afab22a30b
commit 8769606a4b
24 changed files with 379 additions and 182 deletions

View File

@@ -42,7 +42,7 @@ export const fetchPackageDetails = (params) => {
return dispatch => {
dispatch(requestPackageDetails());
return client.fetch({
url: `${API_SERVER}/wp-json/wc/v2/products/${params.idPackage}?cl_id=${params.shopId}`,
url: `${API_SERVER}/wp-json/wc/v2/products/${params.idPackage}?shop_id=${params.shopId}`,
method: 'get'
})
.then(response => {

View File

@@ -29,7 +29,7 @@ export const fetchShopPackages = (shop, search) => {
let searchParam = search ? '?search=' +search : ''
return client.fetch({
url: `${API_SERVER}/wp-json/wc/v2/products?cl_id=${shop.id}` + searchParam,
url: `${API_SERVER}/wp-json/wc/v2/products?shop_id=${shop.id}` + searchParam,
})
.then(response => {
if (response.data) {
@@ -59,10 +59,11 @@ const generateShopOptions = (shops) => {
return shops;
}
export const fetchShops = () => {
export const fetchShops = (userId) => {
return dispatch => {
dispatch(requestShops());
return client.fetch({url: `${API_SERVER}/wp-json/wiaas/customer/0/shops` })
return client.fetch({url: `${API_SERVER}/wp-json/wiaas/customer/${userId}/shops` })
.then(response => {
if(response.data){