From 4c199ef71663ebc75e417c2b95bc2995821ade94 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Mon, 7 Nov 2016 13:34:53 +0100 Subject: [PATCH] sms verification: collect data --- js/src/modals/SMSVerification/GatherData/gatherData.js | 5 ++++- js/src/modals/SMSVerification/SMSVerification.js | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/js/src/modals/SMSVerification/GatherData/gatherData.js b/js/src/modals/SMSVerification/GatherData/gatherData.js index 3e0ce15cb..92317567b 100644 --- a/js/src/modals/SMSVerification/GatherData/gatherData.js +++ b/js/src/modals/SMSVerification/GatherData/gatherData.js @@ -25,7 +25,8 @@ import styles from './gatherData.css'; export default class GatherData extends Component { static propTypes = { onDataIsValid: PropTypes.func.isRequired, - onDataIsInvalid: PropTypes.func.isRequired + onDataIsInvalid: PropTypes.func.isRequired, + onData: PropTypes.func.isRequired } state = { @@ -56,6 +57,7 @@ export default class GatherData extends Component { numberOnSubmit = (value) => { this.numberOnChange(null, value); + this.props.onData({ number: value }); } numberOnChange = (_, value) => { @@ -68,6 +70,7 @@ export default class GatherData extends Component { this.setState({ consentGiven: !!consentGiven }, this.onChange); + this.props.onData({ consent: consentGiven }); } onChange = () => { diff --git a/js/src/modals/SMSVerification/SMSVerification.js b/js/src/modals/SMSVerification/SMSVerification.js index be8353acf..478b0b953 100644 --- a/js/src/modals/SMSVerification/SMSVerification.js +++ b/js/src/modals/SMSVerification/SMSVerification.js @@ -42,8 +42,7 @@ export default class SMSVerification extends Component { contract: null, step: 0, stepIsValid: false, - number: null, - numberError: null + data: {} } componentDidMount () { @@ -123,6 +122,11 @@ export default class SMSVerification extends Component { onDataIsInvalid = () => { this.setState({ stepIsValid: false }); } + onData = (data) => { + this.setState({ + data: Object.assign({}, this.state.data, data) + }); + } next = () => { this.setState({ step: this.state.step + 1, stepIsValid: false });