summaryrefslogtreecommitdiff
path: root/frontend/src
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-07-20 12:44:04 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:48:12 +0200
commit53e60ccf0636e0076837d66a7dbea527e3b6e98d (patch)
tree041f83ae919d7ee9b5691a1666dbb61af26967d0 /frontend/src
parentd8479e7e3744b8d1d31ac4d9f972e560eacd2cf8 (diff)
parent2a5f50e591f5e9c1da5db2f2011c779a88121675 (diff)
Merge pull request #9 from atlarge-research/feat/opendc-node
Add simulator integration
Diffstat (limited to 'frontend/src')
-rw-r--r--frontend/src/api/socket.js8
-rw-r--r--frontend/src/shapes/index.js4
2 files changed, 6 insertions, 6 deletions
diff --git a/frontend/src/api/socket.js b/frontend/src/api/socket.js
index 93ce8fa8..759c119e 100644
--- a/frontend/src/api/socket.js
+++ b/frontend/src/api/socket.js
@@ -6,11 +6,9 @@ let requestIdCounter = 0
const callbacks = {}
export function setupSocketConnection(onConnect) {
- let port = window.location.port
- if (process.env.NODE_ENV !== 'production') {
- port = 8081
- }
- socket = io.connect(window.location.protocol + '//' + window.location.hostname + ':' + port)
+ const apiUrl = process.env.REACT_APP_API_URL || window.location.hostname + ':' + window.location.port;
+
+ socket = io.connect(window.location.protocol + '//' + apiUrl);
socket.on('connect', onConnect)
socket.on('response', onSocketResponse)
}
diff --git a/frontend/src/shapes/index.js b/frontend/src/shapes/index.js
index 32914f25..8296055a 100644
--- a/frontend/src/shapes/index.js
+++ b/frontend/src/shapes/index.js
@@ -111,7 +111,9 @@ Shapes.Scenario = PropTypes.shape({
_id: PropTypes.string.isRequired,
portfolioId: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
- simulationState: PropTypes.string.isRequired,
+ simulation: PropTypes.shape({
+ state: PropTypes.string.isRequired,
+ }).isRequired,
trace: PropTypes.shape({
traceId: PropTypes.string.isRequired,
trace: Shapes.Trace,