changes to pass api_root when client side action

This commit is contained in:
2021-07-21 15:20:06 +01:00
parent ea56f9e228
commit 50998612f1
2 changed files with 11 additions and 1 deletions
+6 -1
View File
@@ -6,7 +6,12 @@ process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
let BASE_URL;
const port = parseInt(process.env.PORT, 10) || 3000;
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
if (process.browser) {
BASE_URL = window.apiRoot;
} else {
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
}
const agent = new https.Agent({
rejectUnauthorized: false,