import { h, Component } from 'preact'; // import PropTypes from 'prop-types'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { Redirect } from 'react-router-dom'; // import { Link } from 'react-router-dom'; import * as authActions from './auth.actions'; import { Group, Param, TextInput, Button } from '../common'; class Login extends Component { state = { username: '', password: '', } constructor() { super() this.handleChange = this.handleChange.bind(this) this.handleSubmit = this.handleSubmit.bind(this) } handleChange(value, name) { this.setState({ [name]: value, error: null, }) } handleSubmit(e) { e.preventDefault() if (this.props.auth.loading) return this.props.actions.login(this.state.username, this.state.password) } render(){ return (
) } renderAuthError(){ if (this.props.auth.error) { return (