Skip to content

Commit

Permalink
fix(request-store-api): fix handling chosing cache or live api host
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Jul 9, 2019
1 parent bfe988a commit 4553d64
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/methods/request-store-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ const requestStoreApi = (
// first check if it's a public request
if (method.toLowerCase() === 'get' && !authenticationId) {
// less timeout for public requests
timeout = 5000
// use cache API host for public requests
baseURL = isCacheOnline ? API_STORE_CACHE : API_STORE
if (isCacheOnline && !/\?/.test(url) && (!axiosConfig || !axiosConfig.params)) {
// use cache API host
timeout = 2500
baseURL = API_STORE_CACHE.replace(':id', storeId)
} else {
timeout = 5000
baseURL = API_STORE
}
} else {
baseURL = API_STORE
// setup authentication headers
Expand Down

0 comments on commit 4553d64

Please sign in to comment.