import React, {Component} from 'react'; import Button from 'material-ui/Button'; import Grid from 'material-ui/Grid'; import TextField from 'material-ui/TextField'; import Typography from 'material-ui/Typography'; import Container from '../component/Container'; import * as UserAction from '../actions/UserAction'; import DefaultPage from '../component/DefaultPage'; import PropTypes from 'prop-types'; class Login extends Component { static propTypes = { loginFailed: PropTypes.bool.isRequired, }; constructor() { super(); this.state = {username: '', password: ''}; } handleChange(propertyName, event) { const state = this.state; state[propertyName] = event.target.value; this.setState(state); } login = () => UserAction.login(this.state.username, this.state.password); render() { const {username, password} = this.state; const {loginFailed} = this.props; return (
e.preventDefault()}> {loginFailed && Login Failed}
); } } export default Login;