pass fields to query into QueryCode
This commit is contained in:
parent
052f9258a5
commit
0e0f602d5e
@ -20,20 +20,25 @@ import { Form, Input } from '~/ui';
|
|||||||
|
|
||||||
export default class QueryCode extends Component {
|
export default class QueryCode extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
number: PropTypes.string.isRequired,
|
receiver: PropTypes.string.isRequired,
|
||||||
|
hint: PropTypes.string,
|
||||||
isCodeValid: PropTypes.bool.isRequired,
|
isCodeValid: PropTypes.bool.isRequired,
|
||||||
setCode: PropTypes.func.isRequired
|
setCode: PropTypes.func.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
hint: 'Enter the code you received.'
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { number, isCodeValid } = this.props;
|
const { receiver, hint, isCodeValid } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form>
|
<Form>
|
||||||
<p>The verification code has been sent to { number }.</p>
|
<p>The verification code has been sent to { receiver }.</p>
|
||||||
<Input
|
<Input
|
||||||
label={ 'verification code' }
|
label={ 'verification code' }
|
||||||
hint={ 'Enter the code you received via SMS.' }
|
hint={ hint }
|
||||||
error={ isCodeValid ? null : 'invalid code' }
|
error={ isCodeValid ? null : 'invalid code' }
|
||||||
onChange={ this.onChange }
|
onChange={ this.onChange }
|
||||||
onSubmit={ this.onSubmit }
|
onSubmit={ this.onSubmit }
|
||||||
|
@ -158,8 +158,8 @@ export default class Verification extends Component {
|
|||||||
return (<p>{ error }</p>);
|
return (<p>{ error }</p>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { method } = this.state;
|
||||||
if (phase === 0) {
|
if (phase === 0) {
|
||||||
const { method } = this.state;
|
|
||||||
const values = Object.values(methods);
|
const values = Object.values(methods);
|
||||||
const value = values.findIndex((v) => v.value === method);
|
const value = values.findIndex((v) => v.value === method);
|
||||||
return (
|
return (
|
||||||
@ -185,7 +185,6 @@ export default class Verification extends Component {
|
|||||||
);
|
);
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
const { method } = this.state;
|
|
||||||
const { setConsentGiven } = this.props.store;
|
const { setConsentGiven } = this.props.store;
|
||||||
|
|
||||||
const fields = []
|
const fields = []
|
||||||
@ -221,9 +220,19 @@ export default class Verification extends Component {
|
|||||||
);
|
);
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
let receiver, hint;
|
||||||
|
if (method === 'sms') {
|
||||||
|
receiver = this.props.store.number;
|
||||||
|
hint = 'Enter the code you received via SMS.';
|
||||||
|
} else if (method === 'email') {
|
||||||
|
receiver = this.props.store.email;
|
||||||
|
hint = 'Enter the code you received via e-mail.';
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<QueryCode
|
<QueryCode
|
||||||
number={ number } fee={ fee } isCodeValid={ isCodeValid }
|
receiver={ receiver }
|
||||||
|
hint={ hint }
|
||||||
|
isCodeValid={ isCodeValid }
|
||||||
setCode={ setCode }
|
setCode={ setCode }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user