2019-02-26 14:51:04 +11:00
|
|
|
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
2019-03-20 05:36:27 +11:00
|
|
|
import RemoteFollow from '../remote_follow/remote_follow.vue'
|
2019-02-26 14:51:04 +11:00
|
|
|
import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
|
|
|
|
|
|
|
|
const FollowCard = {
|
|
|
|
props: [
|
|
|
|
'user',
|
|
|
|
'noFollowsYou'
|
|
|
|
],
|
|
|
|
data () {
|
|
|
|
return {
|
2019-10-09 01:07:01 +11:00
|
|
|
inProgress: false
|
2019-02-26 14:51:04 +11:00
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
2019-03-20 05:36:27 +11:00
|
|
|
BasicUserCard,
|
|
|
|
RemoteFollow
|
2019-02-26 14:51:04 +11:00
|
|
|
},
|
|
|
|
computed: {
|
2019-04-12 06:34:46 +10:00
|
|
|
isMe () {
|
|
|
|
return this.$store.state.users.currentUser.id === this.user.id
|
2019-03-20 05:36:27 +11:00
|
|
|
},
|
|
|
|
loggedIn () {
|
|
|
|
return this.$store.state.users.currentUser
|
2019-02-26 14:51:04 +11:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
followUser () {
|
2019-02-27 02:14:12 +11:00
|
|
|
this.inProgress = true
|
2019-10-09 01:07:01 +11:00
|
|
|
requestFollow(this.user, this.$store).then(() => {
|
2019-02-27 02:14:12 +11:00
|
|
|
this.inProgress = false
|
2019-02-26 14:51:04 +11:00
|
|
|
})
|
|
|
|
},
|
|
|
|
unfollowUser () {
|
2019-02-27 02:14:12 +11:00
|
|
|
this.inProgress = true
|
2019-04-12 06:34:46 +10:00
|
|
|
requestUnfollow(this.user, this.$store).then(() => {
|
2019-02-27 02:14:12 +11:00
|
|
|
this.inProgress = false
|
2019-02-26 14:51:04 +11:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default FollowCard
|