diff --git a/src/common/pages/RegisterNew/index.js b/src/common/pages/RegisterNew/index.js
index f235ea4..355866f 100644
--- a/src/common/pages/RegisterNew/index.js
+++ b/src/common/pages/RegisterNew/index.js
@@ -42,6 +42,10 @@ class RegisterPage extends React.Component {
fileList_photo: [],
query: {},
+ errors: {
+ email_exists: '',
+ phone_exists: '',
+ },
// form
confirmPassword: "",
@@ -140,9 +144,24 @@ class RegisterPage extends React.Component {
// return message.warning("please upload photo");
//}
//
- //if (this.state.upload_ktp === '') {
- // return message.warning("please upload ktp");
- //}
+
+ if (this.state.phone_number === '') {
+ return this.setState({
+ errors: {
+ ...this.state.errors,
+ phone_exists: 'Harap isi nomor handphone anda'
+ }
+ })
+ }
+
+ if (this.state.email === '') {
+ return this.setState({
+ errors: {
+ ...this.state.errors,
+ email_exists: 'Harap isi email anda'
+ }
+ })
+ }
this.setState({ isLoading: true });
@@ -176,7 +195,22 @@ class RegisterPage extends React.Component {
if (err.type === 'BodyValidationError') {
message.error(err.detail[0].message);
} else {
- message.error(err.message);
+ if (err.message.toLowerCase().includes('email')) {
+ this.setState({
+ errors: {
+ ...this.state.errors,
+ email_exists: 'Email sudah terdaftar'
+ }
+ })
+ } else if (err.message.toLowerCase().includes('phone number')) {
+ this.setState({
+ errors: {
+ ...this.state.errors,
+ phone_exists: 'Nomer handphone sudah terdaftar'
+ }
+ })
+ }
+ // message.error(err.message);
}
});
};
@@ -300,10 +334,10 @@ class RegisterPage extends React.Component {
- Tukarkan point!
+ Selamat Datang di BTN Shop!
- Dapatkan promo dan keuntungan dengan BTN
+ Dapatkan promo dan keuntungan lebih dari BTN!
@@ -335,13 +369,15 @@ class RegisterPage extends React.Component {
@@ -354,6 +390,8 @@ class RegisterPage extends React.Component {
margin="normal"
variant="outlined"
fullWidth
+ error={!!this.state.errors.email_exists}
+ helperText={this.state.errors.email_exists}
/>
@@ -525,7 +563,7 @@ class RegisterPage extends React.Component {
{
this.setState({
@@ -536,7 +574,7 @@ class RegisterPage extends React.Component {
})
}}
margin="normal"
- type={"text"}
+ type={"password"}
fullWidth
variant="outlined"
/>