-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathteamCode.tsx
More file actions
65 lines (52 loc) · 1.76 KB
/
teamCode.tsx
File metadata and controls
65 lines (52 loc) · 1.76 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
import React, { FC,useState } from 'react';
import Axios from 'axios';
import './teamCode.scss';
const TeamCode : FC = (): JSX.Element => {
const [form, setForm] = useState({
teamCode: '',
});
const handleInputChange = (
event: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLSelectElement>,
): void => {
const { name, value } = event.target;
setForm({ ...form, [name]: value });
};
function submit(){
/*
Axios.post(`https://hackmerced-tomoe.herokuapp.com/v1/design-merced/apply`, {
teamCode: form.teamCode,
})
*/
Axios.post('https://hackmerced-teamcode.herokuapp.com/addTeam', {
team_code: 'SAMPLE',
user_id: '010101010101'
})
.then((response) => {
console.log(response);
}, (error) => {
console.log(error);
});
/*
Axios.get('https://hackmerced-teamcode.herokuapp.com/getTeamInfo/deleteme3')
.then((response) => {
console.log(response.data);
console.log(response.status);
console.log(response.statusText);
console.log(response.headers);
console.log(response.config);
});
*/
}
return (
<div className="team-code">
<h1>Team Code</h1>
<h3 className="teamCode">fkjlash</h3>
<button className="generateButton" type="button">Generate</button>
<p>- or -</p>
<h2>Enter Team Code!</h2>
<input className="teamcodeInput" type="password" id="codeInput" name="password" onChange={handleInputChange}></input>
<button className="submitButton" type="button" onClick={submit}>Submit</button>
</div>
);
};
export default TeamCode;