Skip to content

Commit

Permalink
Improved: added payload to be send to rule schedule api and removed u…
Browse files Browse the repository at this point in the history
…nused console statement (hotwax#293)
  • Loading branch information
amansinghbais committed Aug 6, 2024
1 parent 2218447 commit d4c479d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const runNow = async (): Promise<any> => {

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 resp = {} as any, payload = {};
let routingGroupId = "";

try {
Expand All @@ -240,13 +240,11 @@ const runNow = async (): Promise<any> => {
}
});

if(!hasError(resp)) {
isOmsConnectionExist = true
} else {
if(hasError(resp)) {
throw resp.data;
}

const payload = {
payload = {
"inputFields": {
"settingTypeEnumId": "RUN_GROUP_ID"
},
Expand Down Expand Up @@ -281,15 +279,20 @@ const runNow = async (): Promise<any> => {

if(!hasError(resp)) {
job = resp.data.schedule
console.log(job);
} else {
throw resp.data;
}

payload = {
routingGroupId,
paused: "Y", // passing Y as we just need to configure the scheduler and do not need to schedule it in active state
}

if(!job.jobName) {
resp = await client({
url: `groups/${routingGroupId}/schedule`,
method: "POST",
data: payload,
baseURL,
headers: {
"api_key": omsRedirectionInfo.token,
Expand Down

0 comments on commit d4c479d

Please sign in to comment.