loginpage.js
2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import React from "react";
import { Typography, Form, Input, Icon, Button} from 'antd';
import { withRouter } from "react-router-dom";
import Axios from 'axios';
const { Title } = Typography;
console.log("start");
const userInfo = async (info) => {
const email = document.getElementById('email').value;
const pw = document.getElementById('password').value;
if(email && pw){
const userVariables = {
email,
pw
}
const response = await Axios.post('/api/login/userInfo', userVariables);
if(response.data === "오마이걸"){
// loginForm.action = `/chat?${response.data}`;
// loginForm.submit();
window.location.href=`/chat?keyword=${response.data}`;
}
}
else{
alert("nothing");
}
}
function loginpage() {
return (
<div>
<div style={{ display: 'flex', justifyContent: 'center', marginTop: '1rem', paddingTop: '10rem' }}>
<Title level={2}>Login Page</Title>
</div>
<div style={{ display: 'flex', justifyContent: 'center', marginTop: '1rem'}}>
<form style={{ width: '350px' }} name = "loginForm">
<Form.Item required>
<Input
id="email"
prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />}
placeholder="Enter your email"
type="email"
/>
</Form.Item>
<Form.Item required>
<Input
id="password"
prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />}
placeholder="Enter your password"
type="password"
/>
</Form.Item>
<Form.Item>
<div>
<Button type="primary" className="login-form-button" style={{ minWidth: '100%' }} onClick={userInfo}>
Log in
</Button>
</div>
<a href="/register">가입하기</a> Or <a href = "/chat"> 비회원으로 사용하기 </a>
</Form.Item>
</form>
</div>
</div>
);
// return (
// htmlType="submit"
// <div>
// <div style={{ display: 'flex', justifyContent: 'center', marginTop: '1rem' }}>
// <Title level={2} >Login Page</Title>
// </div>
// </div>
// )
}
export default withRouter(loginpage);