aboutsummaryrefslogtreecommitdiff
path: root/modern/src/SocketContoller.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-09-07 16:09:01 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-09-07 16:09:01 +1200
commit72aa50650203d6db0b17de59bfd98c9d5b06e3e7 (patch)
tree0cdd9aced5356f8e32d23069cd0bec2b5c8ef484 /modern/src/SocketContoller.js
parent06c4ee387669b1ccb5aa3928fbaa7c3650bfb7fa (diff)
downloadetbsa-traccar-web-72aa50650203d6db0b17de59bfd98c9d5b06e3e7.tar.gz
etbsa-traccar-web-72aa50650203d6db0b17de59bfd98c9d5b06e3e7.tar.bz2
etbsa-traccar-web-72aa50650203d6db0b17de59bfd98c9d5b06e3e7.zip
Add redux and load positions
Diffstat (limited to 'modern/src/SocketContoller.js')
-rw-r--r--modern/src/SocketContoller.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/modern/src/SocketContoller.js b/modern/src/SocketContoller.js
index c07fcff..fe686ed 100644
--- a/modern/src/SocketContoller.js
+++ b/modern/src/SocketContoller.js
@@ -1,4 +1,6 @@
import { Component } from 'react';
+import { connect } from 'react-redux';
+import { updatePositions } from './actions';
class SocketController extends Component {
connectSocket() {
@@ -12,8 +14,7 @@ class SocketController extends Component {
socket.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.positions) {
- // TODO update positions
- console.log(data.positions);
+ this.props.dispatch(updatePositions(data.positions));
}
}
}
@@ -27,4 +28,4 @@ class SocketController extends Component {
}
}
-export default SocketController;
+export default connect()(SocketController);