aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/map')
-rw-r--r--modern/src/map/GeofenceMap.js13
1 files changed, 3 insertions, 10 deletions
diff --git a/modern/src/map/GeofenceMap.js b/modern/src/map/GeofenceMap.js
index c98a8c1..8db175a 100644
--- a/modern/src/map/GeofenceMap.js
+++ b/modern/src/map/GeofenceMap.js
@@ -1,20 +1,13 @@
-import { useEffect, useState } from 'react';
+import { useEffect } from 'react';
+import { useSelector } from 'react-redux';
import { map } from './Map';
-import { useEffectAsync } from '../reactHelper';
import { geofenceToFeature } from './mapUtil';
const GeofenceMap = () => {
const id = 'geofences';
- const [geofences, setGeofences] = useState([]);
-
- useEffectAsync(async () => {
- const response = await fetch('/api/geofences');
- if (response.ok) {
- setGeofences(await response.json());
- }
- }, []);
+ const geofences = useSelector(state => Object.values(state.geofences.items));
useEffect(() => {
map.addSource(id, {