import {connect} from "react-redux";
import {useState} from "react";
import {actionFullLogin} from "../../actions";


const LoginForm = ({onLogin, history}) => {
    const [l, setL] = useState ('')
    const [p, setP] = useState ('')



    return (
        <div className='LoginColumn'>
            <input placeholder='Введите имя' onChange={e => setL(e.target.value)}></input>
            <input type='password' placeholder='Введите пароль' onChange={e => setP(e.target.value)}></input>
            <button onClick={() => {onLogin(l,p); history.push('/')}}>Войти</button>
        </div>
    )
}

export const CLoginForm = connect (null,{onLogin: actionFullLogin})(LoginForm)