Implement shop search and refactor
This commit is contained in:
@@ -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 => {
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user