if (!this.state.username.match(/^[a-zA-Z0-9._-]+@(?!gmail.com)(?!yahoo.com)(?!outlook.com)(?!aol.com)(?!live.com)(?!hotmail.com)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)) {
alert("Only Business Emails Are Allowed");
}
if (!this.state.phonenumber.match(/^[0-9]{10}$/)) {
alert("10 digit mobile number or 10 digit Area code followed by landline number only allowed");
}
else{
let data = Object.assign({
profilePhoto: this.state.files && this.state.files.length == "0" ? "" : this.state.files[0].base64,
}, this.state);
UserAction._createUser(data, (data) => {
console.log(data);
data.response == "SUCCESS" ? this.setState({ gotSuccess:true, openrejectDialog: true}) : alert(data.message)
});
}
I am checking the condition based on match of username and phonenumber. If username or phonenumber is not matched i am getting alert. and on click on "ok" from alert it is going to else I want else statement should be called after successfull completion of "if" conditions
Aucun commentaire:
Enregistrer un commentaire