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")();
// 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
</Typography>
<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.*/}
</Typography>

View File

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

View File

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

View File

@ -160,7 +160,7 @@ export default class Routes extends React.Component {
<Switch>
<Route exact path={LINKS.ROOT} render={props => (<Redirect
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_COMPLETED} component={RegisterCompletedComponent}/>