mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-01 18:20:28 +00:00
Add main user routing
This commit is contained in:
@@ -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;
|
||||||
Reference in New Issue
Block a user