The Root.jsx now updates the page title
This commit is contained in:
parent
7e682671f7
commit
dfe71f37d7
@ -1,9 +1,21 @@
|
|||||||
import Navigation from "@components/Navigation";
|
import Navigation from "@components/Navigation";
|
||||||
import {Outlet} from "react-router-dom";
|
import {Outlet, useLocation} from "react-router-dom";
|
||||||
import {Box, Toolbar} from "@mui/material";
|
import {Box, Toolbar} from "@mui/material";
|
||||||
import Footer from "@components/Footer";
|
import Footer from "@components/Footer";
|
||||||
|
import {useEffect} from "react";
|
||||||
|
import routes from "@/common/routes";
|
||||||
|
import footerRoutes from "@/common/routes/footer.jsx";
|
||||||
|
|
||||||
export const Root = () => <>
|
export const Root = () => {
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
[...routes, ...footerRoutes].forEach(route => {
|
||||||
|
if (route.path === location.pathname) document.title = `LicenseAPI - ${route.name}`;
|
||||||
|
});
|
||||||
|
}, [location]);
|
||||||
|
|
||||||
|
return (<>
|
||||||
<Navigation/>
|
<Navigation/>
|
||||||
|
|
||||||
<Box height="100vh" display="flex" flexDirection="column" sx={{ml: 5, mr: 5}}>
|
<Box height="100vh" display="flex" flexDirection="column" sx={{ml: 5, mr: 5}}>
|
||||||
@ -12,4 +24,5 @@ export const Root = () => <>
|
|||||||
|
|
||||||
<Footer/>
|
<Footer/>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user