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(e) {
const name = e.target.name
const value = e.target.value
this.setState({
[name]: value,
error: null,
})
}
handleSubmit(e) {
e.preventDefault()
this.props.actions.login(this.state.username, this.state.password)
}
render(){
if (this.props.auth.isAuthenticated) {
return