diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-27 11:08:26 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-27 11:08:26 -0700 |
commit | 26916278758cd5e4abb16aa31e31099e066ea8d5 (patch) | |
tree | 5119a65f67cd426ed06b9cb553b7d24ba6dce093 /modern/src/map | |
parent | d86a3ef187359fbe83a5dd950295868c4ef39d09 (diff) | |
download | etbsa-traccar-web-26916278758cd5e4abb16aa31e31099e066ea8d5.tar.gz etbsa-traccar-web-26916278758cd5e4abb16aa31e31099e066ea8d5.tar.bz2 etbsa-traccar-web-26916278758cd5e4abb16aa31e31099e066ea8d5.zip |
Add geofences screen
Diffstat (limited to 'modern/src/map')
-rw-r--r-- | modern/src/map/GeofenceMap.js | 13 |
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, { |