fix(ui) - create account recaptcha reset on error

This commit is contained in:
Shekar Siri 2021-09-07 18:39:10 +05:30
parent 2e75927ff1
commit c920d9c902

View file

@ -26,11 +26,24 @@ export default class SignupForm extends React.Component {
email: '',
projectName: '',
organizationName: '',
reload: false,
};
static getDerivedStateFromProps(props, state) {
if (props.errors && props.errors.size > 0 && state.reload) {
recaptchaRef.current.reset();
return {
reload: false
}
}
return null;
}
handleSubmit = (token) => {
const { tenantId, fullname, password, email, projectName, organizationName, auth } = this.state;
this.props.signup({ tenantId, fullname, password, email, projectName, organizationName, auth, 'g-recaptcha-response': token })
this.setState({ reload: true })
}
write = ({ target: { value, name } }) => this.setState({ [ name ]: value })