aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/MapGeofenceEdit.js
diff options
context:
space:
mode:
authorBoubrid Ihab <boubrid.ihab@gmail.com>2022-05-23 17:15:39 +0100
committerBoubrid Ihab <boubrid.ihab@gmail.com>2022-05-23 17:15:39 +0100
commit0b9209f877c42d9eb69d4b94cfa9c7f16a81967e (patch)
tree72286ee879bea52fa2dad73f36d1e2b36a35bc15 /modern/src/map/MapGeofenceEdit.js
parentc30e57579868b8f3d21e6e6083e37cba8bcfa408 (diff)
parent0ed610e71b28461d6c9cc996764b00db5ac0b2ba (diff)
downloadtrackermap-web-0b9209f877c42d9eb69d4b94cfa9c7f16a81967e.tar.gz
trackermap-web-0b9209f877c42d9eb69d4b94cfa9c7f16a81967e.tar.bz2
trackermap-web-0b9209f877c42d9eb69d4b94cfa9c7f16a81967e.zip
Merge branch 'master' of github.com:traccar/traccar-web into fix-key-issue
Diffstat (limited to 'modern/src/map/MapGeofenceEdit.js')
-rw-r--r--modern/src/map/MapGeofenceEdit.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/modern/src/map/MapGeofenceEdit.js b/modern/src/map/MapGeofenceEdit.js
index c64eb736..0b5062d8 100644
--- a/modern/src/map/MapGeofenceEdit.js
+++ b/modern/src/map/MapGeofenceEdit.js
@@ -5,7 +5,7 @@ import theme from '@mapbox/mapbox-gl-draw/src/lib/theme';
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-import { useHistory } from 'react-router-dom';
+import { useNavigate } from 'react-router-dom';
import { map } from './core/Map';
import { geofenceToFeature, geometryToArea } from './core/mapUtil';
import { errorsActions, geofencesActions } from '../store';
@@ -36,7 +36,7 @@ const draw = new MapboxDraw({
const MapGeofenceEdit = () => {
const dispatch = useDispatch();
- const history = useHistory();
+ const navigate = useNavigate();
const geofences = useSelector((state) => state.geofences.items);
@@ -69,7 +69,7 @@ const MapGeofenceEdit = () => {
});
if (response.ok) {
const item = await response.json();
- history.push(`/settings/geofence/${item.id}`);
+ navigate(`/settings/geofence/${item.id}`);
} else {
throw Error(await response.text());
}
@@ -80,7 +80,7 @@ const MapGeofenceEdit = () => {
map.on('draw.create', listener);
return () => map.off('draw.create', listener);
- }, [dispatch, history]);
+ }, [dispatch, navigate]);
useEffect(() => {
const listener = async (event) => {