Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
export default class LoginContainer extends Component {
getInitState () {
return { username: '', password: ''};
}
onSubmit (event) {
event.preventDefault();
const {username, password} = this.state;
request
.post('/admin/login')
.send({username, password})
.end((error, res) => {
if (error) {
this.setState({
error: res.body.message
});
} else {
window.location.href = '/admin';
}
});
}
fieldChange (id, value) {
this.setState({[id]: value});
}
render () {
return (
<Login ref='login' {...this.props} {...this.state} onSubmit={::this.onSubmit} fieldChange={::this.fieldChange} />
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.