aboutsummaryrefslogtreecommitdiff
path: root/src/components/follow_card
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/follow_card')
-rw-r--r--src/components/follow_card/follow_card.js21
-rw-r--r--src/components/follow_card/follow_card.vue35
2 files changed, 9 insertions, 47 deletions
diff --git a/src/components/follow_card/follow_card.js b/src/components/follow_card/follow_card.js
index 118d0c7c..2c3231a9 100644
--- a/src/components/follow_card/follow_card.js
+++ b/src/components/follow_card/follow_card.js
@@ -1,6 +1,6 @@
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
import RemoteFollow from '../remote_follow/remote_follow.vue'
-import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
+import FollowButton from '../follow_button/follow_button.vue'
const FollowCard = {
props: [
@@ -8,13 +8,12 @@ const FollowCard = {
'noFollowsYou'
],
data () {
- return {
- inProgress: false
- }
+ return { }
},
components: {
BasicUserCard,
- RemoteFollow
+ RemoteFollow,
+ FollowButton
},
computed: {
isMe () {
@@ -25,18 +24,6 @@ const FollowCard = {
}
},
methods: {
- followUser () {
- this.inProgress = true
- requestFollow(this.user, this.$store).then(() => {
- this.inProgress = false
- })
- },
- unfollowUser () {
- this.inProgress = true
- requestUnfollow(this.user, this.$store).then(() => {
- this.inProgress = false
- })
- }
}
}
diff --git a/src/components/follow_card/follow_card.vue b/src/components/follow_card/follow_card.vue
index a9d237bb..a43cac4e 100644
--- a/src/components/follow_card/follow_card.vue
+++ b/src/components/follow_card/follow_card.vue
@@ -16,36 +16,11 @@
</div>
</template>
<template v-else>
- <button
- v-if="!user.following"
- class="btn btn-default follow-card-follow-button"
- :disabled="inProgress"
- :title="user.requested ? $t('user_card.follow_again') : ''"
- @click="followUser"
- >
- <template v-if="inProgress">
- {{ $t('user_card.follow_progress') }}
- </template>
- <template v-else-if="user.requested">
- {{ $t('user_card.follow_sent') }}
- </template>
- <template v-else>
- {{ $t('user_card.follow') }}
- </template>
- </button>
- <button
- v-else
- class="btn btn-default follow-card-follow-button pressed"
- :disabled="inProgress"
- @click="unfollowUser"
- >
- <template v-if="inProgress">
- {{ $t('user_card.follow_progress') }}
- </template>
- <template v-else>
- {{ $t('user_card.follow_unfollow') }}
- </template>
- </button>
+ <FollowButton
+ :user="user"
+ button-class="follow-card-follow-button"
+ :label-following="$t('user_card.follow_unfollow')"
+ />
</template>
</div>
</basic-user-card>