import { connect } from 'umi';
import LoginComponent from '../../components/login/Login';

function Login({ dispatch, login }) {
  const LoginProps = {
    login,
    onLogin: userlogin,
    onClearModelCenter: clearModelCenter, /* 清空KPI工作中心 */
  };

  function userlogin(param) {
    dispatch({
      type: 'login/login',
      payload: { ...param, dispatch },
    });
  }

  function clearModelCenter() {
    /* 清空KPI工作中心 */
    dispatch({ type: 'app/clearModelCenter' });
  }

  return (
    <div>
      <LoginComponent {...LoginProps} />
    </div>
  );
}

export default connect(({ login }) => ({ login }))(Login);
