Remove hostname check when creating API endpoint URLs now that they are proxied

This commit is contained in:
Andrew Kingston 2021-01-11 09:38:40 +00:00
parent ae5d970a92
commit e94cdf1f8e
1 changed files with 1 additions and 10 deletions

View File

@ -3,14 +3,6 @@
*/
let cache = {}
/**
* Makes a fully formatted URL based on the SDK configuration.
*/
const makeFullURL = path => {
const isProxy = window.location.pathname.startsWith("/app/")
return `${isProxy ? "/app/" : "/"}${path}`.replace("//", "/")
}
/**
* Handler for API errors.
*/
@ -81,8 +73,7 @@ const makeCachedApiCall = async params => {
*/
const requestApiCall = method => async params => {
const { url, cache = false } = params
const fullURL = makeFullURL(url)
const enrichedParams = { ...params, method, url: fullURL }
const enrichedParams = { ...params, method, url }
return await (cache ? makeCachedApiCall : makeApiCall)(enrichedParams)
}