fix: register flow
This commit is contained in:
parent
8839560fbd
commit
db161ed8b2
|
@ -30,9 +30,9 @@ imageUrl = "https://giift-api.asacreative.com";
|
||||||
type = 'localhost';
|
type = 'localhost';
|
||||||
if(window.location.href.includes("localhost") || window.location.href.includes("marketplace-store")){
|
if(window.location.href.includes("localhost") || window.location.href.includes("marketplace-store")){
|
||||||
// appUrl = 'http://localhost:7700';
|
// appUrl = 'http://localhost:7700';
|
||||||
apiUrl = "http://localhost:4001/"
|
apiUrl = "http://localhost:4010/"
|
||||||
}else{
|
}else{
|
||||||
appUrl = 'https://sillyfish.asacreative.com';
|
appUrl = 'https://giift-api.asacreative.com';
|
||||||
}
|
}
|
||||||
|
|
||||||
export const APP_TYPE = 'btn';
|
export const APP_TYPE = 'btn';
|
||||||
|
|
|
@ -61,6 +61,10 @@ class BTNLoginPage extends React.Component{
|
||||||
this.setState({
|
this.setState({
|
||||||
isLoading: false
|
isLoading: false
|
||||||
});
|
});
|
||||||
|
this.props.history.push({
|
||||||
|
pathname:LINKS.OTP,
|
||||||
|
search:'?login_request_id='+res.login_request_id+'&expired_at='+res.expired_at
|
||||||
|
});
|
||||||
//redirect to otp page
|
//redirect to otp page
|
||||||
} else {
|
} else {
|
||||||
notification.open({
|
notification.open({
|
||||||
|
|
|
@ -59,8 +59,8 @@ class OtpPage extends React.Component{
|
||||||
console.log(this.urlParams);
|
console.log(this.urlParams);
|
||||||
this.setState({
|
this.setState({
|
||||||
otpData:{
|
otpData:{
|
||||||
login_request_id : urlParams.get('login_request_id'),
|
login_request_id : this.urlParams.get('login_request_id'),
|
||||||
expired_at : urlParams.get('expired_at')
|
expired_at : this.urlParams.get('expired_at')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ class OtpPage extends React.Component{
|
||||||
},4000)
|
},4000)
|
||||||
});
|
});
|
||||||
// }
|
// }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
|
@ -200,4 +200,4 @@ class OtpPage extends React.Component{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withStyles(styles)(OtpPage);
|
export default withStyles(styles)(OtpPage);
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
message,
|
message,
|
||||||
Button,
|
Button,
|
||||||
Spin,
|
Spin,
|
||||||
Icon
|
Icon, notification
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import css from 'reactcss';
|
import css from 'reactcss';
|
||||||
import RegisterForm from './Form';
|
import RegisterForm from './Form';
|
||||||
|
@ -68,8 +68,15 @@ export default class ComponentName extends React.Component {
|
||||||
.authStore
|
.authStore
|
||||||
.register(value)
|
.register(value)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
message.success(res.message);
|
notification.open({
|
||||||
|
message: 'Register Success',
|
||||||
|
description: 'Please check your email to continue'
|
||||||
|
});
|
||||||
|
this.props.history.push({
|
||||||
|
pathname:LINKS.LOGIN
|
||||||
|
});
|
||||||
this.setState({isLoading: false, isSuccess: true})
|
this.setState({isLoading: false, isSuccess: true})
|
||||||
|
// this
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err && err.errors && err.errors[0] && err.errors[0].message) {
|
if (err && err.errors && err.errors[0] && err.errors[0].message) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ export class Authentication {
|
||||||
@observable isLoggingIn = false;
|
@observable isLoggingIn = false;
|
||||||
@observable isInviting = false;
|
@observable isInviting = false;
|
||||||
@observable removingUser = false;
|
@observable removingUser = false;
|
||||||
@observable isNeedEmailVerification = false;
|
// @observable isNeedEmailVerification = false;
|
||||||
@observable userWallet = {};
|
@observable userWallet = {};
|
||||||
@observable userProfile = {
|
@observable userProfile = {
|
||||||
email : '',
|
email : '',
|
||||||
|
@ -52,9 +52,10 @@ export class Authentication {
|
||||||
return this.http.post("authentication/login", data)
|
return this.http.post("authentication/login", data)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.isLoggingIn = false;
|
this.isLoggingIn = false;
|
||||||
this.isNeedEmailVerification = res.need_email_verification;
|
if(res.token) {
|
||||||
this.context.setToken(res.token);
|
this.context.setToken(res.token);
|
||||||
this.context.loadDataAfterLogin();
|
this.context.loadDataAfterLogin();
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
@ -141,6 +142,8 @@ export class Authentication {
|
||||||
validateOtp(data) {
|
validateOtp(data) {
|
||||||
return this.http.post("authentication/validate_otp", data)
|
return this.http.post("authentication/validate_otp", data)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
this.context.setToken(res.token);
|
||||||
|
this.context.loadDataAfterLogin();
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user