From bd256e0f4433168b4910b806ee69327fd8927354 Mon Sep 17 00:00:00 2001 From: adam-skowronek Date: Fri, 16 Dec 2022 01:43:00 +0100 Subject: [PATCH] Fix routes --- frontend/src/App.tsx | 3 +++ frontend/src/views/coordinator/Group.tsx | 11 +++++++++-- frontend/src/views/coordinator/Groups.tsx | 20 +++++++++++++++++--- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 455b18d..6864eb3 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -70,8 +70,11 @@ function App() { }> } /> } /> + } /> + } /> } /> } /> + } /> diff --git a/frontend/src/views/coordinator/Group.tsx b/frontend/src/views/coordinator/Group.tsx index 6a5e45b..2c66d9d 100644 --- a/frontend/src/views/coordinator/Group.tsx +++ b/frontend/src/views/coordinator/Group.tsx @@ -1,9 +1,10 @@ import { useQuery } from 'react-query' -import { Link, useParams } from 'react-router-dom' +import { Link, useLocation, useParams } from 'react-router-dom' import { getGroup } from '../../api/groups' const Group = () => { const { id } = useParams<{ id: string }>() + const location = useLocation() const { data: groups } = useQuery(['getGroup'], () => getGroup(Number(id))) const { name, project_supervisor } = groups?.data || {} @@ -15,7 +16,13 @@ const Group = () => { Opiekun: {project_supervisor?.first_name}{' '} {project_supervisor?.last_name} - + diff --git a/frontend/src/views/coordinator/Groups.tsx b/frontend/src/views/coordinator/Groups.tsx index 424a3b7..b422461 100644 --- a/frontend/src/views/coordinator/Groups.tsx +++ b/frontend/src/views/coordinator/Groups.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames' import { useEffect, useState } from 'react' import { useMutation, useQuery } from 'react-query' -import { useNavigate } from 'react-router-dom' +import { useLocation, useNavigate } from 'react-router-dom' import useLocalStorageState from 'use-local-storage-state' import { deleteGroup, getGroups } from '../../api/groups' import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg' @@ -9,6 +9,8 @@ import { Link } from 'react-router-dom' const Groups = () => { let navigate = useNavigate() + const location = useLocation() + const [page, setPage] = useState(1) const [perPage, setPerPage] = useState(10) const [yearGroupId] = useLocalStorageState('yearGroupId') @@ -60,7 +62,15 @@ const Groups = () => {
@@ -97,7 +107,11 @@ const Groups = () => { {name}