aboutsummaryrefslogtreecommitdiff
path: root/src/components/follow_card/follow_card.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-03-07 15:11:11 +0000
committerShpuld Shpludson <shp@cock.li>2019-03-07 15:11:11 +0000
commit7e9c8c3d219aa3b787c5606efbb54a73c1738b07 (patch)
tree1847fa78707d800e28997bd8828327cf5c890838 /src/components/follow_card/follow_card.js
parent4800169f36e0a71c322b9707a797c3b1ad48bf58 (diff)
parentc44f0a9bde08c50598207494b121ae4bdf1f0fb1 (diff)
Merge branch 'develop' into 'master'
Update master See merge request pleroma/pleroma-fe!646
Diffstat (limited to 'src/components/follow_card/follow_card.js')
-rw-r--r--src/components/follow_card/follow_card.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/components/follow_card/follow_card.js b/src/components/follow_card/follow_card.js
new file mode 100644
index 00000000..425c9c3e
--- /dev/null
+++ b/src/components/follow_card/follow_card.js
@@ -0,0 +1,45 @@
+import BasicUserCard from '../basic_user_card/basic_user_card.vue'
+import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
+
+const FollowCard = {
+ props: [
+ 'user',
+ 'noFollowsYou'
+ ],
+ data () {
+ return {
+ inProgress: false,
+ requestSent: false,
+ updated: false
+ }
+ },
+ components: {
+ BasicUserCard
+ },
+ computed: {
+ isMe () { return this.$store.state.users.currentUser.id === this.user.id },
+ following () { return this.updated ? this.updated.following : this.user.following },
+ showFollow () {
+ return !this.following || this.updated && !this.updated.following
+ }
+ },
+ methods: {
+ followUser () {
+ this.inProgress = true
+ requestFollow(this.user, this.$store).then(({ sent, updated }) => {
+ this.inProgress = false
+ this.requestSent = sent
+ this.updated = updated
+ })
+ },
+ unfollowUser () {
+ this.inProgress = true
+ requestUnfollow(this.user, this.$store).then(({ updated }) => {
+ this.inProgress = false
+ this.updated = updated
+ })
+ }
+ }
+}
+
+export default FollowCard