diff --git a/src/common/config/app.js b/src/common/config/app.js index 3af42e4..224f94e 100644 --- a/src/common/config/app.js +++ b/src/common/config/app.js @@ -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'; diff --git a/src/common/pages/Login/LoginBtn.js b/src/common/pages/Login/LoginBtn.js index f2e8995..6f55470 100644 --- a/src/common/pages/Login/LoginBtn.js +++ b/src/common/pages/Login/LoginBtn.js @@ -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({ diff --git a/src/common/pages/Otp/index.js b/src/common/pages/Otp/index.js index 3b9fb62..0da308b 100644 --- a/src/common/pages/Otp/index.js +++ b/src/common/pages/Otp/index.js @@ -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') } }); } @@ -119,7 +119,7 @@ class OtpPage extends React.Component{ },4000) }); // } - + }; render(){ @@ -200,4 +200,4 @@ class OtpPage extends React.Component{ } } -export default withStyles(styles)(OtpPage); \ No newline at end of file +export default withStyles(styles)(OtpPage); diff --git a/src/common/pages/Register/index.js b/src/common/pages/Register/index.js index a594576..e7af026 100644 --- a/src/common/pages/Register/index.js +++ b/src/common/pages/Register/index.js @@ -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) { diff --git a/src/common/stores/authenticaton.js b/src/common/stores/authenticaton.js index 25a8b75..2e20726 100644 --- a/src/common/stores/authenticaton.js +++ b/src/common/stores/authenticaton.js @@ -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 => {