summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web/opendc-web-ui/src/api')
-rw-r--r--opendc-web/opendc-web-ui/src/api/routes/token-signin.js4
-rw-r--r--opendc-web/opendc-web-ui/src/api/socket.js4
2 files changed, 5 insertions, 3 deletions
diff --git a/opendc-web/opendc-web-ui/src/api/routes/token-signin.js b/opendc-web/opendc-web-ui/src/api/routes/token-signin.js
index e40127f2..ced5d2e0 100644
--- a/opendc-web/opendc-web-ui/src/api/routes/token-signin.js
+++ b/opendc-web/opendc-web-ui/src/api/routes/token-signin.js
@@ -1,5 +1,7 @@
+import config from '../../config'
+
export function performTokenSignIn(token) {
- const apiUrl = window.$$env['API_BASE_URL'] || ''
+ const apiUrl = config['API_BASE_URL']
return fetch(`${apiUrl}/tokensignin`, {
method: 'POST',
diff --git a/opendc-web/opendc-web-ui/src/api/socket.js b/opendc-web/opendc-web-ui/src/api/socket.js
index 884c4152..87facda8 100644
--- a/opendc-web/opendc-web-ui/src/api/socket.js
+++ b/opendc-web/opendc-web-ui/src/api/socket.js
@@ -1,5 +1,6 @@
import io from 'socket.io-client'
import { getAuthToken } from '../auth/index'
+import config from '../config'
let socket
let requestIdCounter = 0
@@ -7,8 +8,7 @@ const callbacks = {}
export function setupSocketConnection(onConnect) {
const apiUrl =
- window.$$env['API_BASE_URL'] ||
- `${window.location.protocol}//${window.location.hostname}:${window.location.port}`
+ config['API_BASE_URL'] || `${window.location.protocol}//${window.location.hostname}:${window.location.port}`
socket = io.connect(apiUrl)
socket.on('connect', onConnect)