update : otp interface

This commit is contained in:
enggar_ganteng 2019-01-28 21:10:53 +07:00
parent 8b2f3ac089
commit 1156034b0e
2 changed files with 18 additions and 3 deletions

View File

@ -60,7 +60,10 @@ class OtpPage extends React.Component{
};
resendCode = () => {
this.setState({isResending:true});
setTimeout(()=>{
this.setState({isResending:false});
},3000);
}
login = () => {
@ -89,6 +92,15 @@ class OtpPage extends React.Component{
const { classes } = this.props;
return (
<div className={classes.container}>
<Snackbar
anchorOrigin={{ vertical : 'top', horizontal: 'center' }}
open={this.state.isResending}
onClose={()=>this.setState({isResending:false})}
ContentProps={{
'aria-describedby': 'message-id',
}}
message={<span id="message-id">OTP Code Re-sended</span>}
/>
<Grid container spacing={0} className={classes.gridContainer}>
<Grid item xs={12} className={classes.logoContainer}>
<img src={require('../../../../assets/images/login/logo_new.png')} className={classes.logo} />
@ -112,7 +124,7 @@ class OtpPage extends React.Component{
Input Your OTP Code
</Typography>
<Typography variant="subtitle2" gutterBottom>
Still not received OTP Code? <Link to={"/register"}>Resend Code</Link>
Still not received OTP Code? <a onClick={()=>this.resendCode()}>Resend Code</a>
</Typography>
<Grid container justify="center" spacing={8}>
{[0, 1, 2, 3, 4, 5].map(x => (

View File

@ -1,5 +1,6 @@
import { observable, action, computed} from 'mobx';
import * as fetch from 'isomorphic-fetch';
import { resolve } from 'url';
export class Authentication {
@ -8,7 +9,7 @@ export class Authentication {
@observable isLoggingIn = false;
@observable isInviting = false;
@observable removingUser = false;
@observable isNeedEmailVerification = false;
@observable userWallet = {};
@observable userProfile = {
email : '',
@ -50,8 +51,10 @@ export class Authentication {
return this.http.post("authentication/login", data)
.then(res => {
this.isLoggingIn = false;
this.isNeedEmailVerification = res.need_email_verification;
this.context.setToken(res.token);
this.context.loadDataAfterLogin();
return res;
})
.catch(err => {
this.isLoggingIn = false;