-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuthPage.jsx
34 lines (29 loc) · 942 Bytes
/
AuthPage.jsx
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
import axios from 'axios'
const AuthPage = (props) => {
const onSubmit = (e) => {
e.preventDefault();
const { value } = e.target[0];
axios.post(
'http://localhost:3001/authenticate',
{username: value}
)
.then(r => props.onAuth({ ...r.data, secret: value }))
.catch(e => console.log('error', e))
};
return (
<div className="background">
<form onSubmit={onSubmit} className="form-card">
<div className="form-title">Welcome 👋</div>
<div className="form-subtitle">Set a username to get started</div>
<div className="auth">
<div className="auth-label">Username</div>
<input className="auth-input" name="username" />
<button className="auth-button" type="submit">
Enter
</button>
</div>
</form>
</div>
);
};
export default AuthPage;