diff --git a/actions/index.js b/actions/index.js index 7cc0c2fe..137f0666 100644 --- a/actions/index.js +++ b/actions/index.js @@ -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, diff --git a/pages/_document.js b/pages/_document.js index db5a51a5..237f4716 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -23,6 +23,11 @@ class MyDocument extends Document {
+ {!process.browser && ( + + )}