Skip to content

Commit

Permalink
Improved: getter for baseUrl to handle case with api with /api and re…
Browse files Browse the repository at this point in the history
…moved unused service (hotwax#244)
  • Loading branch information
amansinghbais committed Mar 18, 2024
1 parent 065c781 commit 5c261b2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
11 changes: 0 additions & 11 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ const login = async (username: string, password: string): Promise <any> => {
});
}

const checkPermission = async (payload: any): Promise <any> => {
let baseURL = store.getters['user/getInstanceUrl'];
baseURL = baseURL && baseURL.startsWith('http') ? (baseURL.includes('/api') ? baseURL : `${baseURL}/api/`) : `https://${baseURL}.hotwax.io/api/`;
return client({
url: "checkPermission",
method: "post",
baseURL: baseURL,
...payload
});
}

const getProfile = async (): Promise <any> => {
return api({
url: "user-profile",
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/user/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const getters: GetterTree <UserState, RootState> = {
getBaseUrl(state) {
let baseURL = process.env.VUE_APP_BASE_URL;
if (!baseURL) baseURL = state.instanceUrl;
return baseURL.startsWith('http') ? baseURL : `https://${baseURL}.hotwax.io/api/`;
return baseURL.startsWith('http') ? baseURL.includes('/api') ? baseURL : `${baseURL}/api/` : `https://${baseURL}.hotwax.io/api/`;
},
getUserToken (state) {
return state.token
Expand Down

0 comments on commit 5c261b2

Please sign in to comment.