aboutsummaryrefslogtreecommitdiff
path: root/modern/src/SocketController.js
diff options
context:
space:
mode:
authorditoaugusta <dt_ap@ymail.com>2020-03-24 15:04:52 +0700
committerditoaugusta <dt_ap@ymail.com>2020-03-24 15:04:52 +0700
commit2f8ae58f4f5cde892b4b6981a83a37edc1422a2c (patch)
treef9354abc103d4dde4f98effbdf46739fefe4ac1f /modern/src/SocketController.js
parent78d69f50595e058a08f3eaaa47fd7c3745fa1266 (diff)
downloadtrackermap-web-2f8ae58f4f5cde892b4b6981a83a37edc1422a2c.tar.gz
trackermap-web-2f8ae58f4f5cde892b4b6981a83a37edc1422a2c.tar.bz2
trackermap-web-2f8ae58f4f5cde892b4b6981a83a37edc1422a2c.zip
experiment: redux toolkit
Diffstat (limited to 'modern/src/SocketController.js')
-rw-r--r--modern/src/SocketController.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js
index b89845f2..10db17a4 100644
--- a/modern/src/SocketController.js
+++ b/modern/src/SocketController.js
@@ -1,6 +1,6 @@
import { Component } from 'react';
import { connect } from 'react-redux';
-import { updateDevices, updatePositions } from './actions';
+import { positionsActions, devicesActions } from 'store/modules';
const displayNotifications = events => {
if ("Notification" in window) {
@@ -31,10 +31,10 @@ class SocketController extends Component {
socket.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.devices) {
- this.props.dispatch(updateDevices(data.devices));
+ this.props.dispatch(devicesActions.update(data.devices));
}
if (data.positions) {
- this.props.dispatch(updatePositions(data.positions));
+ this.props.dispatch(positionsActions.update(data.positions));
}
if (data.events) {
displayNotifications(data.events);
@@ -46,7 +46,7 @@ class SocketController extends Component {
fetch('/api/devices').then(response => {
if (response.ok) {
response.json().then(devices => {
- this.props.dispatch(updateDevices(devices));
+ this.props.dispatch(devicesActions.update(devices));
});
}
this.connectSocket();