Projekt

Obecné

Profil

Stáhnout (1.06 KB) Statistiky
| Větev: | Tag: | Revize:
1
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 { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
import { faFileExport } from '@fortawesome/free-solid-svg-icons';
8
import { Typography } from 'antd';
9
import { LoggedUserContext } from '../../contexts/LoggedUserContext';
10
import { MainLayout } from '../../layouts/mainLayout';
11

    
12
function ExportPage() {
13
    const redirecting = useUnauthRedirect('/login');
14
    const { logout, role } = useContext(LoggedUserContext);
15
    const router = useRouter();
16

    
17
    useEffect(() => {
18
        if (role !== 'ADMINISTRATOR') {
19
            logout();
20
            router.push('/login');
21
        }
22
    }, [logout, redirecting, role, router]);
23

    
24
    return redirecting || role !== 'ADMINISTRATOR' ? null : (
25
        <MainLayout>
26
            <Typography.Title level={2}>
27
                <FontAwesomeIcon icon={faFileExport} /> Export
28
            </Typography.Title>
29
        </MainLayout>
30
    );
31
}
32

    
33
export default ExportPage;
    (1-1/1)