mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
chore: dashboard
This commit is contained in:
22
src/routes.tsx
vendored
Normal file
22
src/routes.tsx
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { useLayoutEffect } from 'react';
|
||||
import { useLocation, useRoutes } from 'react-router-dom';
|
||||
import type { RouteObject } from 'react-router-dom';
|
||||
|
||||
import App from '@view/App';
|
||||
|
||||
const routes: RouteObject[] = [
|
||||
{
|
||||
path: '/',
|
||||
element: <App />
|
||||
}
|
||||
];
|
||||
|
||||
export default () => {
|
||||
const location = useLocation();
|
||||
const pathname = location.pathname;
|
||||
useLayoutEffect(() => {
|
||||
const name = pathname.substring(1).replace(/\//gi, '_');
|
||||
document.body.className = `${name ? name : 'main'}_screen`
|
||||
}, [pathname]);
|
||||
return useRoutes(routes);
|
||||
};
|
||||
Reference in New Issue
Block a user