Skip to content

Commit 9363e7c

Browse files
committed
feat: support new optional ECOMCLIENT_API_PASSPORT_IDENTITY env for passport on identity endpoints
useful to separate passport api proxy and auth flow endpoints (v2)
1 parent db4146d commit 9363e7c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/lib/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const IS_BROWSER = Boolean(typeof window === 'object' && window !== null
55
export const API_STORE = env.ECOMCLIENT_API_STORE || 'https://api.e-com.plus/v1/'
66
export const API_STORE_CACHE = env.ECOMCLIENT_API_STORE_CACHE || 'https://ioapi.ecvol.com/:id/v1/'
77
export const API_PASSPORT = env.ECOMCLIENT_API_PASSPORT || 'https://passport.e-com.plus/v1/'
8+
export const API_PASSPORT_IDENTITY = env.ECOMCLIENT_API_PASSPORT_IDENTITY
89
export const API_SEARCH = env.ECOMCLIENT_API_SEARCH || 'https://apx-search.e-com.plus/api/v1/'
910
export const API_MODULES = env.ECOMCLIENT_API_MODULES || 'https://apx-mods.e-com.plus/api/v1/'
1011
export const API_STOREFRONT = env.ECOMCLIENT_API_STOREFRONT || 'https://iostorefront.ecvol.com/api/v1/'

src/methods/passport.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { _config } from '@ecomplus/utils'
2-
import { API_PASSPORT } from './../lib/constants'
2+
import { API_PASSPORT_IDENTITY, API_PASSPORT } from './../lib/constants'
33
import request from './../lib/request'
44

55
const passport = ({
@@ -12,6 +12,9 @@ const passport = ({
1212
axiosConfig
1313
}) => {
1414
let baseURL = API_PASSPORT
15+
if (API_PASSPORT_IDENTITY && /\/(identify|token|oauth-providers)(\.json)?$/.test(url)) {
16+
baseURL = API_PASSPORT_IDENTITY
17+
}
1518
if (!url.startsWith('http') && !url.startsWith('/' + storeId)) {
1619
// set Store ID on URL
1720
baseURL += storeId

0 commit comments

Comments
 (0)