show error if member is not eligible
This commit is contained in:
@@ -37,7 +37,8 @@ class SignUp extends React.Component {
|
||||
validated: false,
|
||||
memberType:"S",
|
||||
showValidationErrors: false,
|
||||
validationErrors:[]
|
||||
validationErrors:[],
|
||||
draggableDialog:false
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
@@ -63,7 +64,8 @@ class SignUp extends React.Component {
|
||||
"phonenumber": this.state.phonenumber,
|
||||
"birthdate": this.state.birthdate.toISOString(),
|
||||
"consent" : this.state.agreedTerms,
|
||||
"type": this.state.memberType
|
||||
"type": this.state.memberType,
|
||||
"useruuid": "1234567"
|
||||
|
||||
// "eligibility": {
|
||||
// "tracking_id": "1234567",
|
||||
@@ -105,13 +107,26 @@ class SignUp extends React.Component {
|
||||
// alert('NO benefits found for this member');
|
||||
// }
|
||||
}).catch(function (err) {
|
||||
if (err.response.status === 422){
|
||||
//Unprocessable Entity (validation failed)
|
||||
state.setState(Object.assign(state.state, {showValidationErrors:true, validationErrors:err.response.data.data}))
|
||||
}else{
|
||||
console.log('Error to get eligibility: ', err);
|
||||
alert('NO benefits found for this member');
|
||||
this.handleRequestClose();
|
||||
switch(err.response.status){
|
||||
case 403:
|
||||
//Forbidden (not eligible)
|
||||
console.log(err.response.data);
|
||||
let messageArray = [
|
||||
{
|
||||
message:err.response.data.message
|
||||
}
|
||||
]
|
||||
state.setState(Object.assign(state.state, {showValidationErrors:true, validationErrors:messageArray, draggableDialog:false}))
|
||||
break;
|
||||
case 422:
|
||||
//Unprocessable Entity (validation failed)
|
||||
state.setState(Object.assign(state.state, {showValidationErrors:true, validationErrors:err.response.data.data, draggableDialog:true}))
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('Error to get eligibility: ', err);
|
||||
alert('NO benefits found for this member');
|
||||
this.handleRequestClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -192,7 +207,7 @@ class SignUp extends React.Component {
|
||||
return (
|
||||
<form className="">
|
||||
<fieldset>
|
||||
<ValidationErrorsInfoDialog open = {this.state.showValidationErrors} errorMessages = {this.state.validationErrors} modal={true} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
|
||||
<ValidationErrorsInfoDialog open = {this.state.showValidationErrors} errorMessages = {this.state.validationErrors} draggable={this.state.draggableDialog} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
|
||||
<div className="form-group">
|
||||
<TextField
|
||||
floatingLabelText="First Name"
|
||||
|
||||
Reference in New Issue
Block a user