Projekt

Obecné

Profil

Stáhnout (2.15 KB) Statistiky
| Větev: | Tag: | Revize:
1
import { Form, Input, Button } from 'antd';
2
import { UserOutlined, LockOutlined } from '@ant-design/icons';
3
import 'antd/dist/antd.css';
4
import LoginLayout from '../../layouts/loginLayout';
5

    
6
function Login() {
7
    const onFinish = (values: any) => {
8
        /**
9
         @todo: delete login form log when login API is implemented
10
        **/
11
        console.log('Values of the login form: ', values);
12
    };
13

    
14
    const onFinishFailed = (errorInfo: any) => {
15
        /**
16
         @todo: delete log when error handling is implemented
17
        **/
18
        console.log('Errors: ', errorInfo);
19
    };
20

    
21
    return (
22
        <LoginLayout>
23
            <Form
24
                name="login"
25
                onFinish={onFinish}
26
                onFinishFailed={onFinishFailed}
27
                autoComplete="off"
28
            >
29
                <Form.Item
30
                    name="email"
31
                    rules={[
32
                        {
33
                            required: true,
34
                            message: 'Prosím zadejte svůj email',
35
                        },
36
                        {
37
                            type: 'email',
38
                            message:
39
                                'Prosím zadejte svůj email ve formátu: "jmeno@example.com"',
40
                        },
41
                    ]}
42
                >
43
                    <Input
44
                        prefix={<UserOutlined className="site-form-item-icon" />}
45
                        placeholder="Email"
46
                    />
47
                </Form.Item>
48

    
49
                <Form.Item
50
                    name="password"
51
                    rules={[{ required: true, message: 'Prosím zadejte své heslo' }]}
52
                >
53
                    <Input.Password
54
                        prefix={<LockOutlined className="site-form-item-icon" />}
55
                        placeholder="Heslo"
56
                    />
57
                </Form.Item>
58
                <Form.Item>
59
                    <Button type="primary" htmlType="submit" className="w-100">
60
                        Přihlásit
61
                    </Button>
62
                </Form.Item>
63
            </Form>
64
        </LoginLayout>
65
    );
66
}
67

    
68
export default Login;
    (1-1/1)