1 |
8c45ccb0
|
hrubyjar
|
import 'antd/dist/antd.css';
|
2 |
|
|
import React, { useContext, useEffect } from 'react';
|
3 |
|
|
|
4 |
|
|
import { useUnauthRedirect } from '../../hooks';
|
5 |
|
|
import { useRouter } from 'next/router';
|
6 |
|
|
import { Typography } from 'antd';
|
7 |
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
8 |
|
|
import { faBookmark } from '@fortawesome/free-solid-svg-icons';
|
9 |
|
|
import { LoggedUserContext } from '../../contexts/LoggedUserContext';
|
10 |
51f70e00
|
Lukáš Vlček
|
import { MainLayout } from '../../layouts/MainLayout';
|
11 |
8c45ccb0
|
hrubyjar
|
|
12 |
|
|
function ClassesPage() {
|
13 |
|
|
const redirecting = useUnauthRedirect('/login');
|
14 |
|
|
const { logout, role } = useContext(LoggedUserContext);
|
15 |
|
|
const router = useRouter();
|
16 |
|
|
|
17 |
|
|
useEffect(() => {
|
18 |
06d1aa21
|
Jaroslav Hrubý
|
if (!redirecting && role === 'ADMINISTRATOR') {
|
19 |
8c45ccb0
|
hrubyjar
|
// TODO load classes
|
20 |
|
|
}
|
21 |
|
|
}, [redirecting, role, router]);
|
22 |
|
|
|
23 |
|
|
return redirecting || role !== 'ADMINISTRATOR' ? null : (
|
24 |
|
|
<MainLayout>
|
25 |
|
|
<Typography.Title level={2}>
|
26 |
|
|
<FontAwesomeIcon icon={faBookmark} /> Třídy
|
27 |
|
|
</Typography.Title>
|
28 |
|
|
</MainLayout>
|
29 |
|
|
);
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
export default ClassesPage;
|