aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/GeofenceEditMap.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-04-17 13:33:27 -0700
committerAnton Tananaev <anton@traccar.org>2022-04-17 13:33:27 -0700
commit6505a13e0037d5de5737e940907cc62c4a9107bc (patch)
treec4b4ceeb0a8b4bd7b688ca4c6f1fd59834cc9f6f /modern/src/map/GeofenceEditMap.js
parente470eeb4fcc923bc54968a6561f66c75dab288b9 (diff)
downloadtrackermap-web-6505a13e0037d5de5737e940907cc62c4a9107bc.tar.gz
trackermap-web-6505a13e0037d5de5737e940907cc62c4a9107bc.tar.bz2
trackermap-web-6505a13e0037d5de5737e940907cc62c4a9107bc.zip
Refactor settings layout
Diffstat (limited to 'modern/src/map/GeofenceEditMap.js')
-rw-r--r--modern/src/map/GeofenceEditMap.js6
1 files changed, 3 insertions, 3 deletions
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]);