Browse Source

Login function added

f/frontend-login
Kai Senkowski 7 years ago
parent
commit
ec01bbd86b
  1. 22
      Frontend/src/components/Login.js

22
Frontend/src/components/Login.js

@ -28,6 +28,21 @@ class Login extends Component {
this.setState({ [name]: event.target.value });
};
// Test
// 123Abc!&
login() {
fetch("/login", { method: "POST", body: JSON.stringify(this.state) })
.then(function(response) {
if (response.status === 200) return response.json();
else return response.statusText;
})
.then(function(myJson) {
console.log(myJson);
//document.cookie = myJson;
});
}
render() {
const classes = this.props.classes;
@ -67,7 +82,12 @@ class Login extends Component {
/>
</Grid>
</Grid>
<Fab color="primary" aria-label="Send" className={classes.fab}>
<Fab
color="primary"
aria-label="Send"
className={classes.fab}
onClick={() => this.login()}
>
<SendIcon />
</Fab>
</Grid>

Loading…
Cancel
Save