import { connect } from 'react-redux';
import { StoreState } from 'store/rootReducer';
import authActions from 'store/auth/actions';

import account from 'store/account';
import Login, { StateProps, DispatchProps, OwnProps } from './Login';

const mapStateToProps = (state: StoreState): object => ({
  session: state.session,
  lg: state.content.lg,
});

const mapDispatchToProps = {
  login: authActions.login.request.action,
  afterLogin: account.actions.afterLogin.action,
};
const Wrapped = connect<StateProps, DispatchProps, OwnProps>(
  mapStateToProps,
  mapDispatchToProps,
)(Login);

export default Wrapped;
