File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
src/common/components/forms Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ class AvatarForm extends Component {
121121 } else if ( formData . storage === 'local' ) {
122122 uploadProcedure = this . uploadToLocal ( formData ) ;
123123 }
124- uploadProcedure
124+ return uploadProcedure
125125 . catch ( ( err ) => {
126126 dispatch ( pushErrors ( [ {
127127 title : 'Fail To Upload Avatar' ,
@@ -131,7 +131,7 @@ class AvatarForm extends Component {
131131 throw err ;
132132 } )
133133 . then ( ( downloadURL ) => {
134- userAPI ( getState ( ) . apiEngine )
134+ return userAPI ( getState ( ) . apiEngine )
135135 . update ( {
136136 avatarURL : downloadURL ,
137137 } )
@@ -158,6 +158,7 @@ class AvatarForm extends Component {
158158 const {
159159 handleSubmit,
160160 pristine,
161+ submitting,
161162 invalid,
162163 } = this . props ;
163164 let avatarURL = this . state . avatarURL || this . props . avatarURL ;
@@ -184,7 +185,7 @@ class AvatarForm extends Component {
184185 } ] }
185186 />
186187 < FormFooter >
187- < Button type = "submit" disabled = { pristine || invalid } >
188+ < Button type = "submit" disabled = { pristine || submitting || invalid } >
188189 Upload
189190 </ Button >
190191 </ FormFooter >
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class LoginForm extends Component {
4040 }
4141
4242 _handleSubmit ( formData ) {
43- userAPI ( this . context . store . getState ( ) . apiEngine )
43+ return userAPI ( this . context . store . getState ( ) . apiEngine )
4444 . login ( formData )
4545 . catch ( ( err ) => {
4646 this . context . store . dispatch ( pushErrors ( err ) ) ;
@@ -70,6 +70,7 @@ class LoginForm extends Component {
7070 const {
7171 handleSubmit,
7272 pristine,
73+ submitting,
7374 invalid,
7475 } = this . props ;
7576
@@ -90,7 +91,7 @@ class LoginForm extends Component {
9091 placeholder = "Password"
9192 />
9293 < FormFooter >
93- < Button type = "submit" disabled = { pristine || invalid } >
94+ < Button type = "submit" disabled = { pristine || submitting || invalid } >
9495 Login
9596 </ Button >
9697 </ FormFooter >
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class RegisterForm extends Component {
3131 }
3232
3333 _handleSubmit ( formData ) {
34- userAPI ( this . context . store . getState ( ) . apiEngine )
34+ return userAPI ( this . context . store . getState ( ) . apiEngine )
3535 . register ( formData )
3636 . catch ( ( err ) => {
3737 this . context . store . dispatch ( pushErrors ( err ) ) ;
@@ -46,6 +46,7 @@ class RegisterForm extends Component {
4646 const {
4747 handleSubmit,
4848 pristine,
49+ submitting,
4950 invalid,
5051 } = this . props ;
5152
@@ -73,7 +74,7 @@ class RegisterForm extends Component {
7374 placeholder = "Password"
7475 />
7576 < FormFooter >
76- < Button type = "submit" disabled = { pristine || invalid } >
77+ < Button type = "submit" disabled = { pristine || submitting || invalid } >
7778 Register
7879 </ Button >
7980 </ FormFooter >
You can’t perform that action at this time.
0 commit comments