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 {
|
||||
static propTypes = {
|
||||
number: PropTypes.string.isRequired,
|
||||
receiver: PropTypes.string.isRequired,
|
||||
hint: PropTypes.string,
|
||||
isCodeValid: PropTypes.bool.isRequired,
|
||||
setCode: PropTypes.func.isRequired
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
hint: 'Enter the code you received.'
|
||||
}
|
||||
|
||||
render () {
|
||||
const { number, isCodeValid } = this.props;
|
||||
const { receiver, hint, isCodeValid } = this.props;
|
||||
|
||||
return (
|
||||
<Form>
|
||||
<p>The verification code has been sent to { number }.</p>
|
||||
<p>The verification code has been sent to { receiver }.</p>
|
||||
<Input
|
||||
label={ 'verification code' }
|
||||
hint={ 'Enter the code you received via SMS.' }
|
||||
hint={ hint }
|
||||
error={ isCodeValid ? null : 'invalid code' }
|
||||
onChange={ this.onChange }
|
||||
onSubmit={ this.onSubmit }
|
||||
|
@ -158,8 +158,8 @@ export default class Verification extends Component {
|
||||
return (<p>{ error }</p>);
|
||||
}
|
||||
|
||||
const { method } = this.state;
|
||||
if (phase === 0) {
|
||||
const { method } = this.state;
|
||||
const values = Object.values(methods);
|
||||
const value = values.findIndex((v) => v.value === method);
|
||||
return (
|
||||
@ -185,7 +185,6 @@ export default class Verification extends Component {
|
||||
);
|
||||
|
||||
case 2:
|
||||
const { method } = this.state;
|
||||
const { setConsentGiven } = this.props.store;
|
||||
|
||||
const fields = []
|
||||
@ -221,9 +220,19 @@ export default class Verification extends Component {
|
||||
);
|
||||
|
||||
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 (
|
||||
<QueryCode
|
||||
number={ number } fee={ fee } isCodeValid={ isCodeValid }
|
||||
receiver={ receiver }
|
||||
hint={ hint }
|
||||
isCodeValid={ isCodeValid }
|
||||
setCode={ setCode }
|
||||
/>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user