Projekt

Obecné

Profil

Stáhnout (1.22 KB) Statistiky
| Větev: | Tag: | Revize:
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 { Layout, Typography } from 'antd';
7 7a32656e Jaroslav Hrubý
import UserNavBar from '../../../components/navigation/UserNavBar';
8 8c45ccb0 hrubyjar
import { faFileLines } from '@fortawesome/free-solid-svg-icons';
9
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
10
import { LoggedUserContext } from '../../../contexts/LoggedUserContext';
11
import { MainLayout } from '../../../layouts/mainLayout';
12
13
function UserDocumentPage() {
14
    const redirecting = useUnauthRedirect('/login');
15
    const { logout, role } = useContext(LoggedUserContext);
16
    const router = useRouter();
17
18
    useEffect(() => {
19
        if (role !== 'ANNOTATOR') {
20
            logout();
21
            router.push('/login');
22
        }
23
24
        if (!redirecting) {
25
            // TODO load documents
26
        }
27
    }, [logout, redirecting, role, router]);
28
29
    return redirecting || role !== 'ANNOTATOR' ? null : (
30
        <MainLayout>
31
            <Typography.Title level={2}>
32
                <FontAwesomeIcon icon={faFileLines} /> Dokumenty
33
            </Typography.Title>
34
        </MainLayout>
35
    );
36
}
37
38
export default UserDocumentPage;