Commit b01f6813 authored by “Yevgeniy's avatar “Yevgeniy

minor fix of imports and remove of comments

parent 9ddb2ade
...@@ -50,13 +50,6 @@ router.get("/id/:id",async (req:Request, res:Response): Promise<Response> => { ...@@ -50,13 +50,6 @@ router.get("/id/:id",async (req:Request, res:Response): Promise<Response> => {
router.get('/userId/:userId', async (req : Request, res : Response): Promise<Response>=>{ router.get('/userId/:userId', async (req : Request, res : Response): Promise<Response>=>{
const userId:string = req.params.userId const userId:string = req.params.userId
const user = await dataSource
.createQueryBuilder()
.select("user")
.from(User, "user")
.where("user.id = :id", { id: userId })
.getOne()
console.log('user ', user)
const userProjects = await dataSource const userProjects = await dataSource
.createQueryBuilder() .createQueryBuilder()
.select('project') .select('project')
......
import {Routes, Route, Outlet, Navigate, BrowserRouter} from "react-router-dom"; import {Routes, Route, Outlet, Navigate, BrowserRouter} from "react-router-dom";
import {Container} from "@mui/material"; import {Container} from "@mui/material";
import {useSelector} from "react-redux"; import {useSelector} from "react-redux";
import AppToolbar from './components/UI/AppToolBar/AppToolbar' import AppToolbar from "./components/UI/AppToolBar/AppToolBar";
import MyTasks from './containers/MyTasks/MyTasks' import MyTasks from './containers/MyTasks/MyTasks';
import Login from './containers/Login/Login' import Login from './containers/Login/Login';
import Register from './containers/Register/Register' import Register from './containers/Register/Register';
const ProtectedRoute = ({isAllowed, roles, redirectUrl, children}) => { const ProtectedRoute = ({isAllowed, roles, redirectUrl, children}) => {
const user = useSelector(state => state.users?.user); const user = useSelector(state => state.users?.user);
......
import {AppBar, Box, Toolbar, Typography} from "@mui/material";
import {NavLink} from "react-router-dom";
import {useSelector} from "react-redux";
import HasAccess from "../HasAccess/HasAccess";
import AnonymousMenu from "../../Menus/AnonymousMenu/AnonymousMenu";
import WorkerMenu from "../../Menus/WorkerMenu/WorkerMenu";
import AdminMenu from "../../Menus/AdminMenu/AdminMenu";
const AppToolbar = () => {
const user = useSelector(state => state.users.user);
return <Box sx={{ flexGrow: 1, mb: "40px" }}>
<AppBar position="static">
<Toolbar>
<Typography
variant="h4"
component="div"
sx={{ flexGrow: 1 }}>
<NavLink to='/' style={{textDecoration: 'none', color: 'inherit'}}>Task Manager</NavLink>
</Typography>
<HasAccess allowed={!user}>
<AnonymousMenu/>
</HasAccess>
<HasAccess roles={['user']}>
<WorkerMenu/>
</HasAccess>
<HasAccess roles={['superuser']}>
<AdminMenu/>
</HasAccess>
</Toolbar>
</AppBar>
</Box>
};
export default AppToolbar;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment