import { getClientInfoReq } from '@/services/auth';
import { to } from '@/utils/promise';
import SessionStorage from '@/utils/sessionStorage';
import { gotoOAuth2 } from '@/utils/ui';
import { useEffect } from 'react';
import styles from './login.less';

const Login = () => {
  useEffect(() => {
    getClientInfo();
  }, []);

  const getClientInfo = async () => {
    const [res] = await to(getClientInfoReq());
    if (res && res.data) {
      const clientInfo = res.data;
      SessionStorage.setItem(SessionStorage.clientInfoKey, clientInfo, true);
      gotoOAuth2();
    }
  };

  return <div className={styles['user-login']}></div>;
};

export default Login;
