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

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

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

module.exports = addState(Login);
