From 52f565bcb5e14b77757676013d1328ead92e13fa Mon Sep 17 00:00:00 2001 From: Desmond Kyeremeh Date: Fri, 2 Jul 2021 15:18:00 +0000 Subject: Account Route --- modern/src/settings/OptionsLayout/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'modern/src/settings/OptionsLayout/index.js') diff --git a/modern/src/settings/OptionsLayout/index.js b/modern/src/settings/OptionsLayout/index.js index f6f1e4b8..4bcb380e 100644 --- a/modern/src/settings/OptionsLayout/index.js +++ b/modern/src/settings/OptionsLayout/index.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { useHistory, useLocation } from 'react-router-dom'; +import { useLocation } from 'react-router-dom'; import { Typography, Divider, @@ -49,14 +49,13 @@ const useStyles = makeStyles(theme => ({ const OptionsLayout = ({ children }) => { const classes = useStyles(); - const history = useHistory(); const location = useLocation(); const [openDrawer, setOpenDrawer] = useState(false); const [optionTitle, setOptionTitle] = useState(); const routes = useRoutes(); useEffect(() => { - const activeRoute = routes.find(route => route.href === location.pathname); + const activeRoute = routes.find(route => location.pathname.match(route.match)); setOptionTitle(activeRoute.name); }, [location, routes]); @@ -82,7 +81,7 @@ const OptionsLayout = ({ children }) => { classes={{ root: classes.drawerContainer, paper: classes.drawer }} >
- history.push('/')}> + -- cgit v1.2.3