Skip to content

Commit

Permalink
Improved: baseUrl for logging, fetching userProfile and timeZones usi…
Browse files Browse the repository at this point in the history
…ng Admin component (#27)
  • Loading branch information
amansinghbais committed Jun 25, 2024
1 parent cbe67ac commit 9133dce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { hasError } from "@/utils";

const login = async (token: string): Promise <any> => {
const url = store.getters["user/getBaseUrl"]
const baseURL = url.startsWith('http') ? url.includes('/rest/s1/admin') ? url.replace("admin", "available-to-promise") : `${url}/rest/s1/available-to-promise/` : `https://${url}.hotwax.io/rest/s1/available-to-promise/`;
const baseURL = url.startsWith('http') ? url.includes('/rest/s1/admin') ? url : `${url}/rest/s1/admin/` : `https://${url}.hotwax.io/rest/s1/admin/`;
let api_key = ""

try {
Expand Down Expand Up @@ -33,7 +33,7 @@ const login = async (token: string): Promise <any> => {

const getUserProfile = async (token: any): Promise<any> => {
const url = store.getters["user/getBaseUrl"]
const baseURL = url.startsWith('http') ? url.includes('/rest/s1/admin') ? url.replace("admin", "available-to-promise") : `${url}/rest/s1/available-to-promise/` : `https://${url}.hotwax.io/rest/s1/available-to-promise/`;
const baseURL = url.startsWith('http') ? url.includes('/rest/s1/admin') ? url : `${url}/rest/s1/admin/` : `https://${url}.hotwax.io/rest/s1/admin/`;
try {
const resp = await client({
url: "user/profile",
Expand All @@ -53,7 +53,7 @@ const getUserProfile = async (token: any): Promise<any> => {

const getAvailableTimeZones = async (): Promise <any> => {
const url = store.getters["user/getBaseUrl"]
const baseURL = url.startsWith('http') ? url.includes('/rest/s1/admin') ? url.replace("admin", "available-to-promise") : `${url}/rest/s1/available-to-promise/` : `https://${url}.hotwax.io/rest/s1/available-to-promise/`;
const baseURL = url.startsWith('http') ? url.includes('/rest/s1/admin') ? url : `${url}/rest/s1/admin/` : `https://${url}.hotwax.io/rest/s1/admin/`;
return client({
url: "user/getAvailableTimeZones",
method: "get",
Expand Down

0 comments on commit 9133dce

Please sign in to comment.