aboutsummaryrefslogtreecommitdiff
path: root/modern/src/SocketController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-23 06:44:15 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-23 06:44:15 -0700
commitddcb42512e95e98806db0523e4d954484a6e48cc (patch)
tree795fbd841eb94ded02ce66a2a2c50c2cc52a7dcd /modern/src/SocketController.js
parentfdbc6762b10233950d9c84fc71a9a8c11823f0a9 (diff)
downloadtrackermap-web-ddcb42512e95e98806db0523e4d954484a6e48cc.tar.gz
trackermap-web-ddcb42512e95e98806db0523e4d954484a6e48cc.tar.bz2
trackermap-web-ddcb42512e95e98806db0523e4d954484a6e48cc.zip
Upgrade router and navigation
Diffstat (limited to 'modern/src/SocketController.js')
-rw-r--r--modern/src/SocketController.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js
index 9826d4b1..f776ebc7 100644
--- a/modern/src/SocketController.js
+++ b/modern/src/SocketController.js
@@ -1,7 +1,7 @@
import React, { useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector, connect } from 'react-redux';
import { Snackbar } from '@material-ui/core';
-import { useHistory } from 'react-router-dom';
+import { useNavigate } from 'react-router-dom';
import { positionsActions, devicesActions, sessionActions } from './store';
import { useEffectAsync } from './reactHelper';
@@ -11,7 +11,7 @@ import { snackBarDurationLongMs } from './common/util/duration';
const SocketController = () => {
const dispatch = useDispatch();
- const history = useHistory();
+ const navigate = useNavigate();
const t = useTranslation();
const authenticated = useSelector((state) => !!state.session.user);
@@ -74,7 +74,7 @@ const SocketController = () => {
if (response.ok) {
dispatch(sessionActions.updateUser(await response.json()));
} else {
- history.push('/login');
+ navigate('/login');
}
return null;
}, [authenticated]);