From 30e7c57764d6115770b46bfdedd2422ad7697cb6 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Tue, 5 Mar 2019 11:39:55 +0100 Subject: [PATCH] Fixed shout and follow behavior --- components/FollowButton.vue | 14 ++++++++++---- components/ShoutButton.vue | 12 ++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/components/FollowButton.vue b/components/FollowButton.vue index 21e51f407..75cac49b5 100644 --- a/components/FollowButton.vue +++ b/components/FollowButton.vue @@ -34,17 +34,23 @@ export default { .mutate({ mutation: gql` mutation($id: ID!) { - follow(id: $id) + follow(id: $id, type: User) } `, variables: { id: this.followId } }) - .then(() => { + .then(res => { + if (res && res.data && res.data.follow) { + this.$emit('update') + this.$nextTick(() => { + this.disabled = true + }) + } + }) + .finally(() => { this.loading = false - this.disabled = true - this.$emit('update') }) } } diff --git a/components/ShoutButton.vue b/components/ShoutButton.vue index 36e3df64f..280420823 100644 --- a/components/ShoutButton.vue +++ b/components/ShoutButton.vue @@ -4,6 +4,7 @@ style="text-align: center" > { - console.log(res) - this.loading = false - this.disabled = true if (res && res.data && res.data.shout) { - this.shoutedCount++ + this.shoutedCount = this.count + 1 } this.$emit('update') + this.$nextTick(() => { + this.disabled = true + }) + }) + .finally(() => { + this.loading = false }) } }