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