Add main user routing

This commit is contained in:
Hazem Krimi
2021-04-28 21:27:22 +01:00
parent 176e63630b
commit f471087375
+27
View File
@@ -0,0 +1,27 @@
import { Switch, Route, useRouteMatch } from 'react-router-dom';
import { useReactiveVar } from '@apollo/client';
import { roleVar } from '../../graphql/state';
import { Navbar, Sidebar } from '../../components';
import { Project } from '..';
const Main = () => {
const match = useRouteMatch();
const role = useReactiveVar(roleVar);
return (
<>
<Navbar withSidebar={role !== 'admin'} />
{role !== 'admin' && <Sidebar />}
<Switch>
<Route path={`${match.path}/`} exact>
<Project />
</Route>
<Route path={`${match.path}/project`} exact>
<Project />
</Route>
</Switch>
</>
);
};
export default Main;