PLT-7185: Double clicking Create Account attempts to create an account twice (#7025)

* PLT-7185: Disabled submit button after it is clicked for the first time, unless an error occurs

* PLT-7140: Removed all static function decorators that I previously added to jsx files. These were suggested by eslint, but can cause issues for functions that override parent functionality. still can't reproduce the errors seen on spinmint locally, so I'm guessing at this point

(cherry picked from commit 34b87fe88a7e1c05ce97324861124e531a8a840b)
Этот коммит содержится в:
Jonathan
2017-07-31 12:55:49 -04:00
коммит произвёл George Goldberg
родитель 251f000c68
Коммит ed62660e96

Просмотреть файл

@@ -138,7 +138,10 @@ export default class SignupEmail extends React.Component {
if (err.id === 'api.user.login.not_verified.app_error') {
browserHistory.push('/should_verify_email?email=' + encodeURIComponent(user.email) + '&teamname=' + encodeURIComponent(this.state.teamName));
} else {
this.setState({serverError: err.message});
this.setState({
serverError: err.message,
isSubmitting: false
});
}
}
);
@@ -222,12 +225,18 @@ export default class SignupEmail extends React.Component {
handleSubmit(e) {
e.preventDefault();
// bail out if a submission is already in progress
if (this.state.isSubmitting) {
return;
}
if (this.isUserValid()) {
this.setState({
nameError: '',
emailError: '',
passwordError: '',
serverError: ''
serverError: '',
isSubmitting: true
});
const user = {
@@ -243,7 +252,10 @@ export default class SignupEmail extends React.Component {
this.state.inviteId,
this.handleSignupSuccess.bind(this, user),
(err) => {
this.setState({serverError: err.message});
this.setState({
serverError: err.message,
isSubmitting: false
});
}
);
}
@@ -388,6 +400,7 @@ export default class SignupEmail extends React.Component {
type='submit'
onClick={this.handleSubmit}
className='btn-primary btn'
disabled={this.state.isSubmitting}
>
<FormattedMessage
id='signup_user_completed.create'