Add phone number only if verification is complete
parent
74a6c1e8d8
commit
0902936d39
|
@ -177,21 +177,25 @@ export default class PhoneNumbers extends React.Component {
|
||||||
this.setState({continueDisabled: true});
|
this.setState({continueDisabled: true});
|
||||||
const token = this.state.newPhoneNumberCode;
|
const token = this.state.newPhoneNumberCode;
|
||||||
const address = this.state.verifyMsisdn;
|
const address = this.state.verifyMsisdn;
|
||||||
this.state.addTask.haveMsisdnToken(token).then(() => {
|
this.state.addTask.haveMsisdnToken(token).then(([finished]) => {
|
||||||
|
let newPhoneNumber = this.state.newPhoneNumber;
|
||||||
|
if (finished) {
|
||||||
|
const msisdns = [
|
||||||
|
...this.props.msisdns,
|
||||||
|
{ address, medium: "msisdn" },
|
||||||
|
];
|
||||||
|
this.props.onMsisdnsChange(msisdns);
|
||||||
|
newPhoneNumber = "";
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
addTask: null,
|
addTask: null,
|
||||||
continueDisabled: false,
|
continueDisabled: false,
|
||||||
verifying: false,
|
verifying: false,
|
||||||
verifyMsisdn: "",
|
verifyMsisdn: "",
|
||||||
verifyError: null,
|
verifyError: null,
|
||||||
newPhoneNumber: "",
|
newPhoneNumber,
|
||||||
newPhoneNumberCode: "",
|
newPhoneNumberCode: "",
|
||||||
});
|
});
|
||||||
const msisdns = [
|
|
||||||
...this.props.msisdns,
|
|
||||||
{ address, medium: "msisdn" },
|
|
||||||
];
|
|
||||||
this.props.onMsisdnsChange(msisdns);
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
this.setState({continueDisabled: false});
|
this.setState({continueDisabled: false});
|
||||||
if (err.errcode !== 'M_THREEPID_AUTH_FAILED') {
|
if (err.errcode !== 'M_THREEPID_AUTH_FAILED') {
|
||||||
|
|
Loading…
Reference in New Issue