Добавлены сервисы
This commit is contained in:
parent
31599cd291
commit
bd4bcf5e9e
@ -1,6 +1,5 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Outlet } from 'react-router-dom';
|
import { Outlet } from 'react-router-dom';
|
||||||
import { Container } from 'react-bootstrap';
|
|
||||||
import { CurrentUserContext } from './contexts/CurrentUserContext';
|
import { CurrentUserContext } from './contexts/CurrentUserContext';
|
||||||
import Header from './components/header/header';
|
import Header from './components/header/header';
|
||||||
import Footer from './components/footer/footer';
|
import Footer from './components/footer/footer';
|
||||||
|
@ -11,7 +11,10 @@ const Header = ({ routes }) => {
|
|||||||
const indexPageLink = routes.filter((route) => route.index === false).shift();
|
const indexPageLink = routes.filter((route) => route.index === false).shift();
|
||||||
const currentPage = routes.filter((route) => route.path === location.pathname)[0];
|
const currentPage = routes.filter((route) => route.path === location.pathname)[0];
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
routes = routes.filter((route) => route.onlyNoAuthorized != true);
|
routes = routes.filter((route) => !route.onlyNoAuthorized);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
routes = routes.filter((route) => !route.onlyAuthorized);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -9,6 +9,7 @@ import ErrorPage from './pages/ErrorPage/ErrorPage.jsx'
|
|||||||
import MainPage from './pages/MainPage/MainPage.jsx'
|
import MainPage from './pages/MainPage/MainPage.jsx'
|
||||||
import AuthPage from './pages/AuthPage/AuthPage.jsx'
|
import AuthPage from './pages/AuthPage/AuthPage.jsx'
|
||||||
import RegisterPage from './pages/RegisterPage/RegisterPage.jsx'
|
import RegisterPage from './pages/RegisterPage/RegisterPage.jsx'
|
||||||
|
import StatementsPage from './pages/StatementsPage/StatementsPage.jsx'
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
@ -17,6 +18,13 @@ const routes = [
|
|||||||
element: <MainPage />,
|
element: <MainPage />,
|
||||||
title: 'Главная'
|
title: 'Главная'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/statements',
|
||||||
|
element: <StatementsPage />,
|
||||||
|
title: 'Ведомости',
|
||||||
|
onlyAuthorized: true,
|
||||||
|
onlyTeachers: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/auth',
|
path: '/auth',
|
||||||
element: <AuthPage />,
|
element: <AuthPage />,
|
||||||
|
@ -11,9 +11,12 @@ const AuthPage = () => {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
navigate('/');
|
navigate('/');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
const [inputFields, setInputFields] = useState({
|
const [inputFields, setInputFields] = useState({
|
||||||
username: "",
|
username: "",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
const MainPage = () => {
|
const MainPage = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1>Hello world!</h1>
|
<h1>Mainpage</h1>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
9
src/pages/StatementsPage/StatementsPage.jsx
Normal file
9
src/pages/StatementsPage/StatementsPage.jsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
const StatementsPage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h5>StatementsPage</h5>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StatementsPage
|
5
src/services/CotrolTypesApiService.js
Normal file
5
src/services/CotrolTypesApiService.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ApiService from "../api/ApiService.js";
|
||||||
|
|
||||||
|
const ControlTypesApiService = new ApiService("controltypes");
|
||||||
|
|
||||||
|
export default ControlTypesApiService;
|
5
src/services/MarksApiService.js
Normal file
5
src/services/MarksApiService.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ApiService from "../api/ApiService.js";
|
||||||
|
|
||||||
|
const MarksApiService = new ApiService("marks");
|
||||||
|
|
||||||
|
export default MarksApiService;
|
5
src/services/StatementsApiService.js
Normal file
5
src/services/StatementsApiService.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ApiService from "../api/ApiService.js";
|
||||||
|
|
||||||
|
const StatementsApiService = new ApiService("statements");
|
||||||
|
|
||||||
|
export default StatementsApiService;
|
5
src/services/SubjectsApiService.js
Normal file
5
src/services/SubjectsApiService.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ApiService from "../api/ApiService.js";
|
||||||
|
|
||||||
|
const SubjectsApiService = new ApiService("subjects");
|
||||||
|
|
||||||
|
export default SubjectsApiService;
|
5
src/services/UserMarksApiService.js
Normal file
5
src/services/UserMarksApiService.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ApiService from "../api/ApiService.js";
|
||||||
|
|
||||||
|
const UserMarksApiService = new ApiService("usermarks");
|
||||||
|
|
||||||
|
export default UserMarksApiService;
|
Loading…
Reference in New Issue
Block a user