You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
1.5 KiB

import React, { Component } from 'react';
import Mobile from './Mobile/Mobile';
import Code from './Code/Code';
import { otp } from '../../../Redux/actions/public';
import { login } from '../../../Redux/actions/user';
import { connect } from 'react-redux';
import './Login.scss';
class Login extends Component {
constructor(props) {
super(props);
this.state = {
section: 0,
};
}
async componentDidUpdate() {
const { cellphone, otp, section } = this.state;
// if(cellphone.length === 9 && !otp){
// this.setState({section: 1});
// this.props.otp({cellphone});
// }
if (cellphone && !otp) this.props.otp({ cellphone });
if (section && cellphone && otp) this.props.login({ cellphone, otp });
}
resend = () => {
const {cellphone} = this.state;
this.props.otp({cellphone});
}
render() {
const { section } = this.state;
return (
<div className="login d-flex flex-column">
{section ? <Code parent={this} /> : <Mobile parent={this} />}
<div className="logo__footer d-flex align-self-center">
<h2
style={{
fontFamily: 'IRANSansNumeralBold',
marginRight: 10,
color: 'rgb(108, 72, 191)',
}}
>
Eema
</h2>
<h2 style={{ fontSize: 17, color: 'rgb(108, 72, 191)' }}>Entertainments</h2>
</div>
</div>
);
}
}
export default connect((state) => ({ isLogin: state.user.isLogin }), { otp, login })(Login);