update: otp to redirect

This commit is contained in:
ahmadzuhdi 2019-02-01 15:31:32 +07:00
parent 2ad9968fd9
commit ed6efa59ef
5 changed files with 21 additions and 25 deletions

View File

@ -7,5 +7,5 @@ fs.removeSync(path.normalize(`${__dirname}/../dist`));
require("./link-assets")(); require("./link-assets")();
// Spawn NPM synchronously // Spawn NPM synchronously
const result = spawn.sync('parcel', 'build public/index.parcel.html --log-level 4 --out-file index.html --detailed-report --no-source-maps'.split(" "), { stdio: 'inherit' }); const result = spawn.sync('parcel', 'build public/index.parcel.html --out-file index.html --detailed-report --no-source-maps'.split(" "), { stdio: 'inherit' });

View File

@ -88,7 +88,7 @@ export default class ConfirmationCompletedComponent extends React.Component{
Konfirmasi Berhasil Konfirmasi Berhasil
</Typography> </Typography>
<Typography variant="body1" gutterBottom> <Typography variant="body1" gutterBottom>
Kami telah mengirim sebuah OTP nomor ponsel anda, jika tidak terkirim tekan link ini <a>Resend</a> Terima Kasih, mohon cek email anda untuk langkah selanjutnya
{/*We have sent an email with a confirmation link to your email address. Please allow 5-10 minutes for this message to arrive.*/} {/*We have sent an email with a confirmation link to your email address. Please allow 5-10 minutes for this message to arrive.*/}
</Typography> </Typography>

View File

@ -71,11 +71,7 @@ class OtpPage extends React.Component{
checkIsExpired(){ checkIsExpired(){
console.log(Date.parse(Date().toISOString()),this.state.otpData.expired_at); console.log(Date.parse(Date().toISOString()),this.state.otpData.expired_at);
if(Date.parse(Date().toISOString()) < Date.parse(this.state.otpData.expired_at)){ return Date.parse(Date().toISOString()) >= Date.parse(this.state.otpData.expired_at);
return false;
}else{
return true
}
} }
handleChange = name => event => { handleChange = name => event => {
@ -89,7 +85,7 @@ class OtpPage extends React.Component{
setTimeout(()=>{ setTimeout(()=>{
this.setState({isResending:false}); this.setState({isResending:false});
},3000); },3000);
} };
login = () => { login = () => {
let data = { let data = {
@ -105,19 +101,19 @@ class OtpPage extends React.Component{
// },2000); // },2000);
// } // }
// else{ // else{
// this.authStore.validateOtp(data).then(res=>{ this.authStore.validateOtp(data).then(res=>{
// setTimeout(()=>{ setTimeout(()=>{
// this.props.history.push(LINKS.DASHBOARD); this.props.history.push(LINKS.CONFIRMATION_COMPLETED);
// this.setState({isLoading:false}); this.setState({isLoading:false});
// },1000); },1000);
// }).catch(err=>{ }).catch(err=>{
// setTimeout(()=>{ setTimeout(()=>{
// this.setState({isLoading:false,isOtpWrong:true}); this.setState({isLoading:false,isOtpWrong:true});
// },2000); },2000);
// setTimeout(()=>{ setTimeout(()=>{
// this.setState({isOtpWrong:false}); this.setState({isOtpWrong:false});
// },4000) },4000)
// }); });
// } // }
}; };

View File

@ -132,9 +132,9 @@ class RegisterPage extends React.Component {
// return this.props.history.push(LINKS.LOGIN); // return this.props.history.push(LINKS.LOGIN);
if (this.state.password.length < 8) { // if (this.state.password.length < 8) {
return message.warning("password need atleast 8 characters"); // return message.warning("password need atleast 8 characters");
} // }
// if (this.state.upload_photo === '') { // if (this.state.upload_photo === '') {
// return message.warning("please upload photo"); // return message.warning("please upload photo");

View File

@ -160,7 +160,7 @@ export default class Routes extends React.Component {
<Switch> <Switch>
<Route exact path={LINKS.ROOT} render={props => (<Redirect <Route exact path={LINKS.ROOT} render={props => (<Redirect
to={{ to={{
pathname: this.authStore.isLoggedIn ? LINKS.DASHBOARD : LINKS.LOGIN pathname: this.authStore.isLoggedIn ? LINKS.REGISTER : LINKS.REGISTER
}}/>)}/> }}/>)}/>
<Route exact path={LINKS.REGISTER} component={RegisterComponent}/> <Route exact path={LINKS.REGISTER} component={RegisterComponent}/>
<Route exact path={LINKS.REGISTER_COMPLETED} component={RegisterCompletedComponent}/> <Route exact path={LINKS.REGISTER_COMPLETED} component={RegisterCompletedComponent}/>