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.js26
-rw-r--r--src/components/follow_card/follow_card.vue40
2 files changed, 16 insertions, 50 deletions
diff --git a/src/components/follow_card/follow_card.js b/src/components/follow_card/follow_card.js
index dc4a0d41..aefd609e 100644
--- a/src/components/follow_card/follow_card.js
+++ b/src/components/follow_card/follow_card.js
@@ -1,21 +1,16 @@
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: [
'user',
'noFollowsYou'
],
- data () {
- return {
- inProgress: false,
- requestSent: false
- }
- },
components: {
BasicUserCard,
- RemoteFollow
+ RemoteFollow,
+ FollowButton
},
computed: {
isMe () {
@@ -24,21 +19,6 @@ const FollowCard = {
loggedIn () {
return this.$store.state.users.currentUser
}
- },
- methods: {
- followUser () {
- this.inProgress = true
- requestFollow(this.user, this.$store).then(({ sent }) => {
- this.inProgress = false
- this.requestSent = sent
- })
- },
- 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 94e2836f..81e6e6dc 100644
--- a/src/components/follow_card/follow_card.vue
+++ b/src/components/follow_card/follow_card.vue
@@ -1,40 +1,26 @@
<template>
<basic-user-card :user="user">
<div class="follow-card-content-container">
- <span class="faint" v-if="!noFollowsYou && user.follows_you">
+ <span
+ v-if="!noFollowsYou && user.follows_you"
+ class="faint"
+ >
{{ isMe ? $t('user_card.its_you') : $t('user_card.follows_you') }}
</span>
<template v-if="!loggedIn">
- <div class="follow-card-follow-button" v-if="!user.following">
+ <div
+ v-if="!user.following"
+ class="follow-card-follow-button"
+ >
<RemoteFollow :user="user" />
</div>
</template>
<template v-else>
- <button
- v-if="!user.following"
- class="btn btn-default follow-card-follow-button"
- @click="followUser"
- :disabled="inProgress"
- :title="requestSent ? $t('user_card.follow_again') : ''"
- >
- <template v-if="inProgress">
- {{ $t('user_card.follow_progress') }}
- </template>
- <template v-else-if="requestSent">
- {{ $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" @click="unfollowUser" :disabled="inProgress">
- <template v-if="inProgress">
- {{ $t('user_card.follow_progress') }}
- </template>
- <template v-else>
- {{ $t('user_card.follow_unfollow') }}
- </template>
- </button>
+ <FollowButton
+ :user="user"
+ class="follow-card-follow-button"
+ :label-following="$t('user_card.follow_unfollow')"
+ />
</template>
</div>
</basic-user-card>