Skip to content

Commit

Permalink
Fixed: baseUrl generation logic from omsRedirectionUrl for calling mo…
Browse files Browse the repository at this point in the history
…qui apis (#293)
  • Loading branch information
amansinghbais committed Aug 6, 2024
1 parent a21dca7 commit d5757f1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,14 @@ const getUserProfile = async (token: any): Promise<any> => {
}

const runNow = async (): Promise<any> => {
const omsRedirectionUrl = store.getters['user/getOmsRedirectionInfo'];
if(!omsRedirectionUrl.url || !omsRedirectionUrl.token) {
const omsRedirectionInfo = store.getters['user/getOmsRedirectionInfo'];
if(!omsRedirectionInfo.url || !omsRedirectionInfo.token) {
console.error("Maarg instance is not setup for this account.");
return;
}

const baseURL = omsRedirectionUrl.startsWith('http') ? omsRedirectionUrl.includes('/rest/s1/order-routing') ? omsRedirectionUrl : `${omsRedirectionUrl}/rest/s1/order-routing/` : `https://${omsRedirectionUrl}.hotwax.io/rest/s1/order-routing/`;
const url = omsRedirectionInfo.url
const baseURL = url.startsWith('http') ? url.includes('/rest/s1/order-routing') ? url : `${url}/rest/s1/order-routing/` : `https://${url}.hotwax.io/rest/s1/order-routing/`;
let isOmsConnectionExist = false, resp = {} as any;
let routingGroupId = "";

Expand All @@ -234,7 +235,7 @@ const runNow = async (): Promise<any> => {
method: "GET",
baseURL,
headers: {
"api_key": omsRedirectionUrl.token,
"api_key": omsRedirectionInfo.token,
"Content-Type": "application/json"
}
});
Expand Down Expand Up @@ -272,7 +273,7 @@ const runNow = async (): Promise<any> => {
method: "POST",
baseURL,
headers: {
"api_key": omsRedirectionUrl.token,
"api_key": omsRedirectionInfo.token,
"Content-Type": "application/json"
}
});
Expand Down

0 comments on commit d5757f1

Please sign in to comment.