Merge branch 'fix/lock-submit-until-post-returns' into 'develop'

fix/lock-submit-until-post-returns

See merge request !99
This commit is contained in:
lambadalambda 2017-08-21 08:57:50 -04:00
commit 6e800d9912
3 changed files with 10 additions and 1 deletions

View file

@ -40,6 +40,7 @@ const PostStatusForm = {
dropFiles: [],
submitDisabled: false,
error: null,
posting: false,
newStatus: {
status: statusText,
files: []
@ -86,6 +87,7 @@ const PostStatusForm = {
this.caret = selectionStart
},
postStatus (newStatus) {
this.posting = true
statusPoster.postStatus({
status: newStatus.status,
media: newStatus.files,
@ -104,6 +106,7 @@ const PostStatusForm = {
} else {
this.error = data.error
}
this.posting = false
})
},
addMediaFile (fileInfo) {

View file

@ -17,7 +17,8 @@
</div>
<div class='form-bottom'>
<media-upload @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="enableSubmit" :drop-files="dropFiles"></media-upload>
<button :disabled="submitDisabled" type="submit" class="btn btn-default base05 base01-background">Submit</button>
<button v-if="posting" disabled class="btn btn-default base05 base01-background">Posting</button>
<button v-else :disabled="submitDisabled" type="submit" class="btn btn-default base05 base01-background">Submit</button>
</div>
<div class='error' v-if="error">
Error: {{ error }}

View file

@ -17,6 +17,11 @@ const postStatus = ({ store, status, media = [], inReplyToStatusId = undefined }
}
return data
})
.catch((err) => {
return {
error: err.message
}
})
}
const uploadMedia = ({ store, formData }) => {