Skip to content

Commit

Permalink
Improved: endpoint for fetching shopifyShops using moqui instead of u…
Browse files Browse the repository at this point in the history
…sing ofBiz (#356)
  • Loading branch information
amansinghbais committed Jul 26, 2024
1 parent baa2ab0 commit 842320c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
16 changes: 4 additions & 12 deletions src/services/ChannelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,10 @@ const createFacility = async (payload: any): Promise <any> => {
}

const fetchShopifyConfigs = async (payload: any): Promise<any> => {
const omsRedirectionInfo = store.getters["user/getOmsRedirectionInfo"]
const baseURL = omsRedirectionInfo.url.startsWith('http') ? omsRedirectionInfo.url.includes('/api') ? omsRedirectionInfo.url : `${omsRedirectionInfo.url}/api/` : `https://${omsRedirectionInfo.url}.hotwax.io/api/`;

return client({
url: "performFind",
method: "post",
baseURL,
data: payload,
headers: {
"Authorization": 'Bearer ' + omsRedirectionInfo.token,
'Content-Type': 'application/json'
}
return api({
url: "shopifyShops",
method: "get",
params: payload
});
}

Expand Down
13 changes: 2 additions & 11 deletions src/store/modules/channel/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,9 @@ const actions: ActionTree<ChannelState, RootState> = {
let shopifyConfigs = [];

try {
const payload = {
inputFields: {
productStoreId: store.state.user.currentEComStore.productStoreId,
},
fieldList: ["shopifyConfigId", "name", "shopId"],
entityName: "ShopifyShopAndConfig",
noConditionFind: "Y"
}

const resp = await ChannelService.fetchShopifyConfigs(payload);
const resp = await ChannelService.fetchShopifyConfigs({ productStoreId: store.state.user.currentEComStore.productStoreId });
if (!hasError(resp)) {
shopifyConfigs = resp.data.docs;
shopifyConfigs = resp.data;
} else {
throw resp.data
}
Expand Down

0 comments on commit 842320c

Please sign in to comment.