mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
Apply suggestions
This commit is contained in:
@@ -8,7 +8,7 @@ class SignInContainer extends Component {
|
||||
state = {
|
||||
email: '',
|
||||
password: '',
|
||||
recaptchaResponse: '',
|
||||
recaptchaResponse: null,
|
||||
};
|
||||
|
||||
handleSubmit = () => {
|
||||
|
||||
@@ -46,7 +46,7 @@ export default hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return translateError(this.state.error);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return translateError(this.state.error);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ const withSetUsername = hoistStatics(WrappedComponent => {
|
||||
if (!value) {
|
||||
return t('error.required_field');
|
||||
}
|
||||
return validate.username(value) ? '' : errorMsg.username;
|
||||
return validate.username(value) ? null : errorMsg.username;
|
||||
};
|
||||
|
||||
setUsername = async username => {
|
||||
@@ -64,7 +64,7 @@ const withSetUsername = hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return getErrorMessages(this.state.error).join(', ');
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export default hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return this.state.error.translation_key === 'NOT_AUTHORIZED'
|
||||
? t('error.email_password')
|
||||
|
||||
@@ -51,7 +51,7 @@ const withSignUp = hoistStatics(WrappedComponent => {
|
||||
|
||||
validate = (field, value) => {
|
||||
if (!allFields.includes(field)) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
|
||||
if (requiredFields.includes(field) && !value) {
|
||||
@@ -59,10 +59,10 @@ const withSignUp = hoistStatics(WrappedComponent => {
|
||||
}
|
||||
|
||||
if (field in validate) {
|
||||
return validate[field](value) ? '' : errorMsg[field];
|
||||
return validate[field](value) ? null : errorMsg[field];
|
||||
}
|
||||
|
||||
return '';
|
||||
return null;
|
||||
};
|
||||
|
||||
signUp = ({ username, email, password }, redirectUri) => {
|
||||
@@ -96,7 +96,7 @@ const withSignUp = hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return translateError(this.state.error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user