import React, { useEffect } from 'react';
import styles from './index.less';

import { useAccess, connect } from 'umi';

import TitleGet from '../../components/TitleGet/TitleGet';

const Guard = (props: any) => {
  // var name = pack.name;
  // var version = pack.version;

  const { dispatch, CommunityList, token } = props;
  const tosCommunityget = (values: any) => {
    dispatch({ type: 'Init/tosCommunityget', playload: values });
  };
  // const [page, setPage] = useState({ token: '' });

  useEffect(() => {
    tosCommunityget(null);
    // setPage({ token: getCookie('token') });
  }, []);

  return (
    <div className={styles.base}>
      <TitleGet title={'Version 1.5.2'} />
      {/* <p>
        token:{page.token}
        name:{getCookie('name')}
        phone:{getCookie('phone')}
      </p> */}
    </div>
  );
};

function mapStateToProps(state: any) {
  const { CommunityList } = state.Init;
  const { token } = state.login;
  return {
    CommunityList,
    token,
  };
}

export default connect(mapStateToProps)(Guard);
