fix: register flow
This commit is contained in:
parent
8839560fbd
commit
db161ed8b2
|
@ -30,9 +30,9 @@ imageUrl = "https://giift-api.asacreative.com";
|
|||
type = 'localhost';
|
||||
if(window.location.href.includes("localhost") || window.location.href.includes("marketplace-store")){
|
||||
// appUrl = 'http://localhost:7700';
|
||||
apiUrl = "http://localhost:4001/"
|
||||
apiUrl = "http://localhost:4010/"
|
||||
}else{
|
||||
appUrl = 'https://sillyfish.asacreative.com';
|
||||
appUrl = 'https://giift-api.asacreative.com';
|
||||
}
|
||||
|
||||
export const APP_TYPE = 'btn';
|
||||
|
|
|
@ -61,6 +61,10 @@ class BTNLoginPage extends React.Component{
|
|||
this.setState({
|
||||
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
|
||||
} else {
|
||||
notification.open({
|
||||
|
|
|
@ -59,8 +59,8 @@ class OtpPage extends React.Component{
|
|||
console.log(this.urlParams);
|
||||
this.setState({
|
||||
otpData:{
|
||||
login_request_id : urlParams.get('login_request_id'),
|
||||
expired_at : urlParams.get('expired_at')
|
||||
login_request_id : this.urlParams.get('login_request_id'),
|
||||
expired_at : this.urlParams.get('expired_at')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
message,
|
||||
Button,
|
||||
Spin,
|
||||
Icon
|
||||
Icon, notification
|
||||
} from 'antd';
|
||||
import css from 'reactcss';
|
||||
import RegisterForm from './Form';
|
||||
|
@ -68,8 +68,15 @@ export default class ComponentName extends React.Component {
|
|||
.authStore
|
||||
.register(value)
|
||||
.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
|
||||
})
|
||||
.catch(err => {
|
||||
if (err && err.errors && err.errors[0] && err.errors[0].message) {
|
||||
|
|
|
@ -9,7 +9,7 @@ export class Authentication {
|
|||
@observable isLoggingIn = false;
|
||||
@observable isInviting = false;
|
||||
@observable removingUser = false;
|
||||
@observable isNeedEmailVerification = false;
|
||||
// @observable isNeedEmailVerification = false;
|
||||
@observable userWallet = {};
|
||||
@observable userProfile = {
|
||||
email : '',
|
||||
|
@ -52,9 +52,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();
|
||||
if(res.token) {
|
||||
this.context.setToken(res.token);
|
||||
this.context.loadDataAfterLogin();
|
||||
}
|
||||
return res;
|
||||
})
|
||||
.catch(err => {
|
||||
|
@ -141,6 +142,8 @@ export class Authentication {
|
|||
validateOtp(data) {
|
||||
return this.http.post("authentication/validate_otp", data)
|
||||
.then(res => {
|
||||
this.context.setToken(res.token);
|
||||
this.context.loadDataAfterLogin();
|
||||
return res;
|
||||
})
|
||||
.catch(err => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user