const { connect } = require('preact-redux');

const Login = require('./login.component');

const addState = connect(
    (state) => {
        const { ws, account } = state;
        function submitLogin(name, password) {
            return ws.sendAccountLogin(name, password);
        }
        function submitRegister(name, password) {
            console.log(name, password);
            return ws.sendAccountCreate(name, password);
        }
        return { account, submitLogin, submitRegister };
    },
);

module.exports = addState(Login);
