aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/map')
-rw-r--r--modern/src/map/CurrentPositionsMap.js4
-rw-r--r--modern/src/map/GeofenceEditMap.js6
-rw-r--r--modern/src/map/GeofenceMap.js4
3 files changed, 7 insertions, 7 deletions
diff --git a/modern/src/map/CurrentPositionsMap.js b/modern/src/map/CurrentPositionsMap.js
index 9e00774a..874e0804 100644
--- a/modern/src/map/CurrentPositionsMap.js
+++ b/modern/src/map/CurrentPositionsMap.js
@@ -4,8 +4,8 @@ import { useSelector } from 'react-redux';
import PositionsMap from './PositionsMap';
const CurrentPositionsMap = () => {
- const positions = useSelector((state) => Object.values(state.positions.items));
- return (<PositionsMap positions={positions} />);
+ const positions = useSelector((state) => state.positions.items);
+ return (<PositionsMap positions={Object.values(positions)} />);
};
export default CurrentPositionsMap;
diff --git a/modern/src/map/GeofenceEditMap.js b/modern/src/map/GeofenceEditMap.js
index 91addd43..25c336d1 100644
--- a/modern/src/map/GeofenceEditMap.js
+++ b/modern/src/map/GeofenceEditMap.js
@@ -37,7 +37,7 @@ const GeofenceEditMap = () => {
const dispatch = useDispatch();
const history = useHistory();
- const geofences = useSelector((state) => Object.values(state.geofences.items));
+ const geofences = useSelector((state) => state.geofences.items);
const refreshGeofences = useCallback(async () => {
const response = await fetch('/api/geofences');
@@ -89,7 +89,7 @@ const GeofenceEditMap = () => {
useEffect(() => {
const listener = async (event) => {
const feature = event.features[0];
- const item = geofences.find((i) => i.id === feature.id);
+ const item = Object.values(geofences).find((i) => i.id === feature.id);
if (item) {
const updatedItem = { ...item, area: geometryToArea(feature.geometry) };
const response = await fetch(`/api/geofences/${feature.id}`, {
@@ -109,7 +109,7 @@ const GeofenceEditMap = () => {
useEffect(() => {
draw.deleteAll();
- geofences.forEach((geofence) => {
+ Object.values(geofences).forEach((geofence) => {
draw.add(geofenceToFeature(geofence));
});
}, [geofences]);
diff --git a/modern/src/map/GeofenceMap.js b/modern/src/map/GeofenceMap.js
index c0ecef40..0d27df82 100644
--- a/modern/src/map/GeofenceMap.js
+++ b/modern/src/map/GeofenceMap.js
@@ -7,7 +7,7 @@ import { geofenceToFeature } from './mapUtil';
const GeofenceMap = () => {
const id = 'geofences';
- const geofences = useSelector((state) => Object.values(state.geofences.items));
+ const geofences = useSelector((state) => state.geofences.items);
useEffect(() => {
map.addSource(id, {
@@ -74,7 +74,7 @@ const GeofenceMap = () => {
useEffect(() => {
map.getSource(id).setData({
type: 'FeatureCollection',
- features: geofences.map(geofenceToFeature),
+ features: Object.values(geofences).map(geofenceToFeature),
});
}, [geofences]);