update : login page and auth store
This commit is contained in:
@@ -74,6 +74,13 @@ class BTNLoginPage extends React.Component{
|
|||||||
else if(res.state == "email_verification"){
|
else if(res.state == "email_verification"){
|
||||||
this.setState({isNeedEmailVerification:true,isLoading:false});
|
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 => {
|
}).catch(err => {
|
||||||
console.log("err login",err);
|
console.log("err login",err);
|
||||||
this.setState({loginFailed:true,isLoading:false});
|
this.setState({loginFailed:true,isLoading:false});
|
||||||
@@ -137,7 +144,7 @@ class BTNLoginPage extends React.Component{
|
|||||||
Your account still need email verification
|
Your account still need email verification
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="subtitle2" gutterBottom>
|
<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>
|
</Typography>
|
||||||
|
|
||||||
<div style={{padding : 5,marginTop : 20}}>
|
<div style={{padding : 5,marginTop : 20}}>
|
||||||
|
@@ -37,6 +37,7 @@ export class Authentication {
|
|||||||
// airline_settings: []
|
// airline_settings: []
|
||||||
// }
|
// }
|
||||||
};
|
};
|
||||||
|
@observable otpData = {}
|
||||||
|
|
||||||
constructor(context) {
|
constructor(context) {
|
||||||
this.context = 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) {
|
createCookie(name,value,days) {
|
||||||
let expires
|
let expires
|
||||||
if (days) {
|
if (days) {
|
||||||
|
Reference in New Issue
Block a user