update : login page and auth store
This commit is contained in:
parent
df87d00305
commit
23094db622
|
@ -74,6 +74,13 @@ class BTNLoginPage extends React.Component{
|
|||
else if(res.state == "email_verification"){
|
||||
this.setState({isNeedEmailVerification:true,isLoading:false});
|
||||
}
|
||||
else if(res.state == "phone_verification"){
|
||||
this.authStore.otpData = res;
|
||||
setTimeout(()=>{
|
||||
this.props.history.push(LINKS.OTP);
|
||||
this.setState({isLoading:false});
|
||||
},1000);
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("err login",err);
|
||||
this.setState({loginFailed:true,isLoading:false});
|
||||
|
@ -137,7 +144,7 @@ class BTNLoginPage extends React.Component{
|
|||
Your account still need email verification
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" gutterBottom>
|
||||
Still not received any email? <Link to={"/register"}>Resend email</Link>
|
||||
Still not received any email? <a onClick={()=>this.authStore.resendEmail(this.state.email)}>Resend email</a>
|
||||
</Typography>
|
||||
|
||||
<div style={{padding : 5,marginTop : 20}}>
|
||||
|
|
|
@ -37,6 +37,7 @@ export class Authentication {
|
|||
// airline_settings: []
|
||||
// }
|
||||
};
|
||||
@observable otpData = {}
|
||||
|
||||
constructor(context) {
|
||||
this.context = context;
|
||||
|
@ -117,6 +118,30 @@ export class Authentication {
|
|||
})
|
||||
}
|
||||
|
||||
@action
|
||||
resendEmail(data) {
|
||||
this.isRegistering = true;
|
||||
return this.http.post("/resend_email_verification", data)
|
||||
.then(res => {
|
||||
return res;
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
})
|
||||
}
|
||||
|
||||
@action
|
||||
validateOtp(data) {
|
||||
this.isRegistering = true;
|
||||
return this.http.post("/validate_otp", data)
|
||||
.then(res => {
|
||||
return res;
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
})
|
||||
}
|
||||
|
||||
createCookie(name,value,days) {
|
||||
let expires
|
||||
if (days) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user