diff options
Diffstat (limited to 'src/components/follow_button')
| -rw-r--r-- | src/components/follow_button/follow_button.js | 58 | ||||
| -rw-r--r-- | src/components/follow_button/follow_button.vue | 13 |
2 files changed, 0 insertions, 71 deletions
diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js deleted file mode 100644 index 9d2834ab..00000000 --- a/src/components/follow_button/follow_button.js +++ /dev/null @@ -1,58 +0,0 @@ -import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' -export default { - props: ['user'], - data () { - return { - inProgress: false - } - }, - computed: { - isPressed () { - return this.inProgress || this.user.following - }, - title () { - if (this.inProgress || this.user.following) { - return 'user_card.follow_unfollow' - } else if (this.user.requested) { - return 'user_card.follow_again' - } else { - return '' - } - }, - label () { - if (this.inProgress) { - return 'user_card.follow_progress' - } else if (this.user.following) { - return 'user_card.following' - } else if (this.user.requested) { - return 'user_card.follow_sent' - } else { - return 'user_card.follow' - } - } - }, - methods: { - doClick () { - if (this.user.following) { - this.unfollowUser() - } else { - this.followUser() - } - }, - followUser () { - const store = this.$store - this.inProgress = true - requestFollow(this.user, store).then(() => { - this.inProgress = false - }) - }, - unfollowUser () { - const store = this.$store - this.inProgress = true - requestUnfollow(this.user, store).then(() => { - this.inProgress = false - store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) - }) - } - } -} diff --git a/src/components/follow_button/follow_button.vue b/src/components/follow_button/follow_button.vue deleted file mode 100644 index 61aa75a0..00000000 --- a/src/components/follow_button/follow_button.vue +++ /dev/null @@ -1,13 +0,0 @@ -<template> - <button - class="btn btn-default btn-block follow-button" - :class="{ pressed: isPressed }" - :disabled="inProgress" - :title="$t(title)" - @click="doClick" - > - {{ $t(label) }} - </button> -</template> - -<script src="./follow_button.js"></script> |
