make idempotency watch entire status

This commit is contained in:
Shpuld Shpuldson 2020-07-16 10:18:18 +03:00
parent 89a677f5e8
commit 0c7c24d3d1
2 changed files with 9 additions and 12 deletions

View file

@ -208,14 +208,18 @@ const PostStatusForm = {
}) })
}, },
watch: { watch: {
'newStatus.contentType': function () { 'newStatus': {
this.autoPreview() deep: true,
}, handler () {
'newStatus.spoilerText': function () { this.statusChanged()
this.autoPreview() }
} }
}, },
methods: { methods: {
statusChanged () {
this.autoPreview()
this.updateIdempotencyKey()
},
clearStatus () { clearStatus () {
const newStatus = this.newStatus const newStatus = this.newStatus
this.newStatus = { this.newStatus = {
@ -239,7 +243,6 @@ const PostStatusForm = {
el.style.height = 'auto' el.style.height = 'auto'
el.style.height = undefined el.style.height = undefined
this.error = null this.error = null
this.updateIdempotencyKey()
if (this.preview) this.previewStatus() if (this.preview) this.previewStatus()
}, },
async postStatus (event, newStatus, opts = {}) { async postStatus (event, newStatus, opts = {}) {
@ -407,7 +410,6 @@ const PostStatusForm = {
} }
}, },
onEmojiInputInput (e) { onEmojiInputInput (e) {
this.autoPreview()
this.$nextTick(() => { this.$nextTick(() => {
this.resize(this.$refs['textarea']) this.resize(this.$refs['textarea'])
}) })

View file

@ -30,10 +30,6 @@ const postStatus = ({
idempotencyKey idempotencyKey
}) })
.then((data) => { .then((data) => {
return {
error: 'test'
}
/*
if (!data.error && !preview) { if (!data.error && !preview) {
store.dispatch('addNewStatuses', { store.dispatch('addNewStatuses', {
statuses: [data], statuses: [data],
@ -43,7 +39,6 @@ const postStatus = ({
}) })
} }
return data return data
*/
}) })
.catch((err) => { .catch((err) => {
return { return {