Skip to content
Snippets Groups Projects
Commit 9d948671 authored by Markin Igor's avatar Markin Igor
Browse files

Set up fallback for iframeUrl and apiUrl.

parent 39b914bd
Branches
Tags
1 merge request!7Set up libraries building as static files
This commit is part of merge request !7. Comments created here will be created in the context of that merge request.
...@@ -10,7 +10,13 @@ const Penpal = require('penpal').default; ...@@ -10,7 +10,13 @@ const Penpal = require('penpal').default;
*/ */
function setupViamAPI(divId, methods, iframeUrl, apiUrl) { function setupViamAPI(divId, methods, iframeUrl, apiUrl) {
if (!apiUrl) { if (!apiUrl) {
return Promise.reject('API Host not specified.'); apiUrl = `${window.location.origin}/api/`;
console.warn(`API host URL not specified. Fall back to ${apiUrl}`); // eslint-disable-line no-console
}
if (!iframeUrl) {
iframeUrl = `${window.location.origin}/vcl/js/iframe`;
console.warn(`Iframe URL not specified. Fall back to ${iframeUrl}`); // eslint-disable-line no-console
} }
const connection = Penpal.connectToChild({ const connection = Penpal.connectToChild({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment