Fixed shout and follow behavior

This commit is contained in:
Grzegorz Leoniec 2019-03-05 11:39:55 +01:00
parent dc13467294
commit 30e7c57764
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
2 changed files with 18 additions and 8 deletions

View File

@ -34,17 +34,23 @@ export default {
.mutate({ .mutate({
mutation: gql` mutation: gql`
mutation($id: ID!) { mutation($id: ID!) {
follow(id: $id) follow(id: $id, type: User)
} }
`, `,
variables: { variables: {
id: this.followId id: this.followId
} }
}) })
.then(() => { .then(res => {
this.loading = false if (res && res.data && res.data.follow) {
this.disabled = true
this.$emit('update') this.$emit('update')
this.$nextTick(() => {
this.disabled = true
})
}
})
.finally(() => {
this.loading = false
}) })
} }
} }

View File

@ -4,6 +4,7 @@
style="text-align: center" style="text-align: center"
> >
<ds-button <ds-button
:loading="loading"
:disabled="disabled || loading || isShouted" :disabled="disabled || loading || isShouted"
danger danger
size="x-large" size="x-large"
@ -53,13 +54,16 @@ export default {
} }
}) })
.then(res => { .then(res => {
console.log(res)
this.loading = false
this.disabled = true
if (res && res.data && res.data.shout) { if (res && res.data && res.data.shout) {
this.shoutedCount++ this.shoutedCount = this.count + 1
} }
this.$emit('update') this.$emit('update')
this.$nextTick(() => {
this.disabled = true
})
})
.finally(() => {
this.loading = false
}) })
} }
} }