feat: referal checker

This commit is contained in:
ahmadzuhdi 2019-02-02 12:05:12 +07:00 committed by Hasta Ragil Saputra
parent 4bbeb66ea6
commit 0c0e321b05

View File

@ -45,6 +45,7 @@ class RegisterPage extends React.Component {
errors: {
email_exists: '',
phone_exists: '',
referal_not_found: '',
},
// form
@ -209,8 +210,16 @@ class RegisterPage extends React.Component {
phone_exists: 'Nomer handphone sudah terdaftar'
}
})
} else if (err.message.toLowerCase().includes('referal')) {
this.setState({
errors: {
...this.state.errors,
referal_not_found: 'Kode Referal Salah - Silahkan Hubungi Petugas BTN'
}
})
} else {
message.error(err.message);
}
// message.error(err.message);
}
});
};
@ -576,7 +585,8 @@ class RegisterPage extends React.Component {
margin="normal"
type={"password"}
fullWidth
helperText={"Hubungi petugas untuk mendapatkan hadiah"}
error={!!this.state.errors.referal_not_found}
helperText={this.state.errors.referal_not_found || 'Hubungi petugas untuk mendapatkan hadiah'}
variant="outlined"
/>
</Grid>