// import React from 'react';
import { connect } from 'react-redux';
// import {lifecycle} from 'recompose';
import { createStructuredSelector } from 'reselect';
import { Login } from '../components/login';
import { ACTION as COMMON_ACTION } from '../../common/reducer';
import { fp as _ } from '../../common/utils/fp';
import { ACTION } from '../reducer';
import { makeLoadingSelector, makeAuthErrorSelector } from '../selectors';
import { withErrorBoundary } from '../../common/hoc/with-error-boundary';
import { TAuthErrorNullable, TAuthRootState } from '../types';
// import { make___Selector } from '../selectors';

const mapStateToProps = createStructuredSelector<
  TAuthRootState,
  { loading: boolean; authError: TAuthErrorNullable }
>({
  // prop1: makeSelector(),
  loading: makeLoadingSelector(),
  authError: makeAuthErrorSelector(),
  //†prop
});
const mapDispatchToProps = {
  // action1: ACTION.action1,
  login: COMMON_ACTION.login,
  clearAuthError: ACTION.clearAuthError,
  //†action
};

export default _.compose(
  _.hoistStatics(Login as any),
  withErrorBoundary('auth:login'),
  connect(
    mapStateToProps,
    mapDispatchToProps
  )
)(Login);
