aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/GeofenceMap.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-06-27 11:08:26 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-06-27 11:08:26 -0700
commit26916278758cd5e4abb16aa31e31099e066ea8d5 (patch)
tree5119a65f67cd426ed06b9cb553b7d24ba6dce093 /modern/src/map/GeofenceMap.js
parentd86a3ef187359fbe83a5dd950295868c4ef39d09 (diff)
downloadtrackermap-web-26916278758cd5e4abb16aa31e31099e066ea8d5.tar.gz
trackermap-web-26916278758cd5e4abb16aa31e31099e066ea8d5.tar.bz2
trackermap-web-26916278758cd5e4abb16aa31e31099e066ea8d5.zip
Add geofences screen
Diffstat (limited to 'modern/src/map/GeofenceMap.js')
-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 c98a8c16..8db175a2 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, {