|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
import React, { useState, useRef, useEffect } from "react"; |
|
|
|
|
import {useHistory} from 'react-router-dom'; |
|
|
|
|
import Navbar from "../../../components/Navbar"; |
|
|
|
|
import Footer from "../../Home/Footer"; |
|
|
|
|
import Timer from "../../../components/Timer"; |
|
|
|
@ -17,13 +18,14 @@ interface SignUpFields { |
|
|
|
|
otp?: String; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function SignUp({ sendOtp, sendPhoneNumber }: any) { |
|
|
|
|
function SignUp({ sendOtp, sendPhoneNumber, loginFlag }: any) { |
|
|
|
|
const [level, setLevel] = useState("phonenumber"); |
|
|
|
|
const [signUpFields, setSignUpFiels] = useState<SignUpFields | undefined>( |
|
|
|
|
undefined |
|
|
|
|
); |
|
|
|
|
const [error, setError] = useState<string | undefined>(undefined); |
|
|
|
|
const [resend, setResend] = useState(false); |
|
|
|
|
const history = useHistory(); |
|
|
|
|
|
|
|
|
|
const onChange = (name: string, value: string) => { |
|
|
|
|
setSignUpFiels({ ...signUpFields, [name]: value }); |
|
|
|
@ -83,6 +85,12 @@ function SignUp({ sendOtp, sendPhoneNumber }: any) { |
|
|
|
|
} |
|
|
|
|
}, [level]); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if(loginFlag){ |
|
|
|
|
history.push('/'); |
|
|
|
|
} |
|
|
|
|
},[loginFlag]); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div className="signup d-flex flex-column align-items-center justify-content-center"> |
|
|
|
|
<Navbar /> |
|
|
|
@ -171,7 +179,9 @@ function SignUp({ sendOtp, sendPhoneNumber }: any) { |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default connect(() => ({}), { |
|
|
|
|
export default connect((state : any) => ({ |
|
|
|
|
loginFlag : state.user.setLogin, |
|
|
|
|
}), { |
|
|
|
|
sendOtp: user.otp_login, |
|
|
|
|
sendPhoneNumber: user.otp, |
|
|
|
|
})(SignUp); |
|
|
|
|