Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gocreating committed Oct 12, 2016
2 parents 6737ecf + c919750 commit 88557e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/common/components/forms/AvatarForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class AvatarForm extends Component {
} else if (formData.storage === 'local') {
uploadProcedure = this.uploadToLocal(formData);
}
uploadProcedure
return uploadProcedure
.catch((err) => {
dispatch(pushErrors([{
title: 'Fail To Upload Avatar',
Expand All @@ -131,7 +131,7 @@ class AvatarForm extends Component {
throw err;
})
.then((downloadURL) => {
userAPI(getState().apiEngine)
return userAPI(getState().apiEngine)
.update({
avatarURL: downloadURL,
})
Expand All @@ -158,6 +158,7 @@ class AvatarForm extends Component {
const {
handleSubmit,
pristine,
submitting,
invalid,
} = this.props;
let avatarURL = this.state.avatarURL || this.props.avatarURL;
Expand All @@ -184,7 +185,7 @@ class AvatarForm extends Component {
}]}
/>
<FormFooter>
<Button type="submit" disabled={pristine || invalid}>
<Button type="submit" disabled={pristine || submitting || invalid}>
Upload
</Button>
</FormFooter>
Expand Down
5 changes: 3 additions & 2 deletions src/common/components/forms/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LoginForm extends Component {
}

_handleSubmit(formData) {
userAPI(this.context.store.getState().apiEngine)
return userAPI(this.context.store.getState().apiEngine)
.login(formData)
.catch((err) => {
this.context.store.dispatch(pushErrors(err));
Expand Down Expand Up @@ -70,6 +70,7 @@ class LoginForm extends Component {
const {
handleSubmit,
pristine,
submitting,
invalid,
} = this.props;

Expand All @@ -90,7 +91,7 @@ class LoginForm extends Component {
placeholder="Password"
/>
<FormFooter>
<Button type="submit" disabled={pristine || invalid}>
<Button type="submit" disabled={pristine || submitting || invalid}>
Login
</Button>
</FormFooter>
Expand Down
5 changes: 3 additions & 2 deletions src/common/components/forms/RegisterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class RegisterForm extends Component {
}

_handleSubmit(formData) {
userAPI(this.context.store.getState().apiEngine)
return userAPI(this.context.store.getState().apiEngine)
.register(formData)
.catch((err) => {
this.context.store.dispatch(pushErrors(err));
Expand All @@ -46,6 +46,7 @@ class RegisterForm extends Component {
const {
handleSubmit,
pristine,
submitting,
invalid,
} = this.props;

Expand Down Expand Up @@ -73,7 +74,7 @@ class RegisterForm extends Component {
placeholder="Password"
/>
<FormFooter>
<Button type="submit" disabled={pristine || invalid}>
<Button type="submit" disabled={pristine || submitting || invalid}>
Register
</Button>
</FormFooter>
Expand Down

0 comments on commit 88557e4

Please sign in to comment.