_bb client api, relative url checks for root path,+ handles absolutes
This commit is contained in:
parent
2d909fae30
commit
b7a5bab47c
|
@ -13,10 +13,14 @@ export const bbFactory = ({
|
||||||
uiFunctions,
|
uiFunctions,
|
||||||
onScreenSlotRendered,
|
onScreenSlotRendered,
|
||||||
}) => {
|
}) => {
|
||||||
const relativeUrl = url =>
|
const relativeUrl = url => {
|
||||||
frontendDefinition.appRootPath
|
if (!frontendDefinition.appRootPath) return url
|
||||||
? frontendDefinition.appRootPath + "/" + trimSlash(url)
|
if (url.startsWith("http:")
|
||||||
: url
|
|| url.startsWith("https:")
|
||||||
|
|| url.startsWith("./")) return url
|
||||||
|
|
||||||
|
return frontendDefinition.appRootPath + "/" + trimSlash(url)
|
||||||
|
}
|
||||||
|
|
||||||
const apiCall = method => (url, body) =>
|
const apiCall = method => (url, body) =>
|
||||||
fetch(relativeUrl(url), {
|
fetch(relativeUrl(url), {
|
||||||
|
|
Loading…
Reference in New Issue