mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-25 20:29:45 -04:00
simplify canTryAgain function, reset registrationError on retry
This commit is contained in:
parent
9a97285ac6
commit
469db4dc36
1 changed files with 4 additions and 3 deletions
|
@ -42,8 +42,8 @@ class JoinFlow extends React.Component {
|
|||
// reference its past fields
|
||||
this.state = this.initialState;
|
||||
}
|
||||
canTryAgain (errorTypeAllowsTryAgain) {
|
||||
return (errorTypeAllowsTryAgain && this.state.numAttempts <= 1);
|
||||
canTryAgain () {
|
||||
return (this.state.registrationError.canTryAgain && this.state.numAttempts <= 1);
|
||||
}
|
||||
handleCaptchaError () {
|
||||
this.setState({
|
||||
|
@ -168,6 +168,7 @@ class JoinFlow extends React.Component {
|
|||
}
|
||||
handleSubmitRegistration (formData) {
|
||||
this.setState({
|
||||
registrationError: null, // clear any existing error
|
||||
waiting: true
|
||||
}, () => {
|
||||
api({
|
||||
|
@ -217,7 +218,7 @@ class JoinFlow extends React.Component {
|
|||
<React.Fragment>
|
||||
{this.state.registrationError ? (
|
||||
<RegistrationErrorStep
|
||||
canTryAgain={this.canTryAgain(this.state.registrationError.canTryAgain)}
|
||||
canTryAgain={this.canTryAgain()}
|
||||
errorMsg={this.state.registrationError.errorMsg}
|
||||
/* eslint-disable react/jsx-no-bind */
|
||||
onSubmit={this.handleErrorNext}
|
||||
|
|
Loading…
Add table
Reference in a new issue