Skip to content

Commit

Permalink
Merge pull request #280 from R-Sourabh/#272-Update-oms-api
Browse files Browse the repository at this point in the history
Improved:Updated the oms-api package to resolve login issues encountered when /api is omitted from the complete URL. Additionally, implemented a check in the app to handle direct URL access.
  • Loading branch information
ymaheshwari1 authored Apr 3, 2024
2 parents 6b8cf6c + eedb416 commit b413d3c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@hotwax/app-version-info": "^1.0.0",
"@hotwax/apps-theme": "^1.2.6",
"@hotwax/dxp-components": "1.12.1",
"@hotwax/oms-api": "^1.10.0",
"@hotwax/oms-api": "^1.13.0",
"@ionic/core": "6.7.5",
"@ionic/vue": "6.7.5",
"@ionic/vue-router": "6.7.5",
Expand Down
5 changes: 3 additions & 2 deletions src/adapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { api, client, getConfig, initialise, logout, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api'
import { api, client, getConfig, initialise, logout, resetConfig, updateInstanceUrl, updateToken, setUserLocale } from '@hotwax/oms-api'

export {
api,
Expand All @@ -8,5 +8,6 @@ export {
logout,
resetConfig,
updateInstanceUrl,
updateToken
updateToken,
setUserLocale
}
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { login, logout, loader } from './user-utils';
import permissionPlugin from '@/authorization';
import permissionRules from '@/authorization/Rules';
import permissionActions from '@/authorization/Actions';
import { getConfig, initialise } from '@/adapter'
import { getConfig, initialise, setUserLocale} from '@/adapter'
import localeMessages from './i18n/locales';

const app = createApp(App)
Expand All @@ -54,7 +54,8 @@ const app = createApp(App)
appLoginUrl: process.env.VUE_APP_LOGIN_URL as string,
getConfig: getConfig,
initialise: initialise,
localeMessages
localeMessages,
setUserLocale
});

// Filters are removed in Vue 3 and global filter introduced https://v3.vuejs.org/guide/migration/filters.html#global-filters
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 @@ -25,7 +25,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/`;
},
getPwaState(state) {
return state.pwaState;
Expand Down

0 comments on commit b413d3c

Please sign in to comment.