aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/components/BottomMenu.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/common/components/BottomMenu.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/common/components/BottomMenu.js')
-rw-r--r--modern/src/common/components/BottomMenu.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/modern/src/common/components/BottomMenu.js b/modern/src/common/components/BottomMenu.js
index 30960396..7db4dff8 100644
--- a/modern/src/common/components/BottomMenu.js
+++ b/modern/src/common/components/BottomMenu.js
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-import { useHistory, useLocation } from 'react-router-dom';
+import { useNavigate, useLocation } from 'react-router-dom';
import {
Paper, BottomNavigation, BottomNavigationAction, Menu, MenuItem, Typography,
} from '@material-ui/core';
@@ -16,7 +16,7 @@ import { useTranslation } from './LocalizationProvider';
import { useReadonly } from '../util/permissions';
const BottomMenu = () => {
- const history = useHistory();
+ const navigate = useNavigate();
const location = useLocation();
const dispatch = useDispatch();
const t = useTranslation();
@@ -41,26 +41,26 @@ const BottomMenu = () => {
const handleAccount = () => {
setAnchorEl(null);
- history.push(`/settings/user/${userId}`);
+ navigate(`/settings/user/${userId}`);
};
const handleLogout = async () => {
setAnchorEl(null);
await fetch('/api/session', { method: 'DELETE' });
- history.push('/login');
+ navigate('/login');
dispatch(sessionActions.updateUser(null));
};
const handleSelection = (event, value) => {
switch (value) {
case 0:
- history.push('/');
+ navigate('/');
break;
case 1:
- history.push('/reports/route');
+ navigate('/reports/route');
break;
case 2:
- history.push('/settings/preferences');
+ navigate('/settings/preferences');
break;
case 3:
if (readonly) {