close phone modal after successful verification

This commit is contained in:
Sean Yesmunt 2019-05-10 01:08:48 -04:00 committed by Thomas Zarebczan
parent 7ce6bdb6a4
commit 2e98283d52
2 changed files with 11 additions and 10 deletions

View file

@ -188,7 +188,7 @@
"yarn": "^1.3" "yarn": "^1.3"
}, },
"lbrySettings": { "lbrySettings": {
"lbrynetDaemonVersion": "0.37.0rc5", "lbrynetDaemonVersion": "0.37.0rc6",
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip", "lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
"lbrynetDaemonDir": "static/daemon", "lbrynetDaemonDir": "static/daemon",
"lbrynetDaemonFileName": "lbrynet" "lbrynetDaemonFileName": "lbrynet"

View file

@ -3,7 +3,7 @@ import React, { Suspense } from 'react';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Button from 'component/button'; import Button from 'component/button';
import UserPhoneVerify from 'component/userPhoneVerify'; import UserPhoneVerify from 'component/userPhoneVerify';
import { withRouter } from 'react-router-dom'; import { Redirect } from 'react-router';
const LazyUserPhoneNew = React.lazy(() => const LazyUserPhoneNew = React.lazy(() =>
import(/* webpackChunkName: "userPhoneNew" */ import(/* webpackChunkName: "userPhoneNew" */
@ -13,7 +13,7 @@ const LazyUserPhoneNew = React.lazy(() =>
type Props = { type Props = {
phone: ?number, phone: ?number,
user: { user: {
phone_number: ?number, is_identity_verified: boolean,
}, },
closeModal: () => void, closeModal: () => void,
history: { push: string => void }, history: { push: string => void },
@ -23,29 +23,30 @@ class ModalPhoneCollection extends React.PureComponent<Props> {
getTitle() { getTitle() {
const { user, phone } = this.props; const { user, phone } = this.props;
if (!user.phone_number && !phone) { if (!user.is_identity_verified && !phone) {
return __('Enter Your Phone Number'); return __('Enter Your Phone Number');
} }
return __('Enter The Verification Code'); return __('Enter The Verification Code');
} }
renderInner() { renderInner() {
const { closeModal, phone, user, history } = this.props; const { closeModal, phone, user } = this.props;
const cancelButton = <Button button="link" onClick={closeModal} label={__('Not Now')} />; const cancelButton = <Button button="link" onClick={closeModal} label={__('Not Now')} />;
if (!user.phone_number && !phone) { if (!user.is_identity_verified && !phone) {
return ( return (
<Suspense fallback={<div />}> <Suspense fallback={<div />}>
<LazyUserPhoneNew cancelButton={cancelButton} /> <LazyUserPhoneNew cancelButton={cancelButton} />
</Suspense> </Suspense>
); );
} else if (!user.phone_number) { } else if (!user.is_identity_verified) {
return <UserPhoneVerify cancelButton={cancelButton} />; return <UserPhoneVerify cancelButton={cancelButton} />;
} }
history.push('/$/rewards'); closeModal();
return closeModal(); return <Redirect to="/$/rewards" />;
} }
render() { render() {
@ -64,4 +65,4 @@ class ModalPhoneCollection extends React.PureComponent<Props> {
} }
} }
export default withRouter(ModalPhoneCollection); export default ModalPhoneCollection;