diff options
| author | lambadalambda <gitgud@rogerbraun.net> | 2017-01-01 12:11:55 -0500 |
|---|---|---|
| committer | lambadalambda <gitgud@rogerbraun.net> | 2017-01-01 12:11:55 -0500 |
| commit | eac8fe0c337360ecc766b1920a8d868bd8291213 (patch) | |
| tree | 963af0fad040cf01fb5a4e431b08241775aceee8 /src/components/user_card_content/user_card_content.vue | |
| parent | 0db25bdca0c40a0d3e769b6b503cdadda4962126 (diff) | |
| parent | 8f494b14f0917cabfa584e9a9b3b4521c598c7bb (diff) | |
Merge branch 'feature/follow' into 'develop'
Feature/follow
See merge request !11
Diffstat (limited to 'src/components/user_card_content/user_card_content.vue')
| -rw-r--r-- | src/components/user_card_content/user_card_content.vue | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index 7ad86e63..d9e661a9 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -6,6 +6,24 @@ <span class="glyphicon glyphicon-user"></span> <div class='user-name'>{{user.name}}</div> <div class='user-screen-name'>@{{user.screen_name}}</div> + <div v-if="isOtherUser" class="following-info"> + <div v-if="user.follows_you" class="following"> + Follows you! + </div> + <div class="followed"> + <span v-if="user.following"> + Following them! + <button @click="unfollowUser"> + Unfollow! + </button> + </span> + <span v-if="!user.following" > + <button @click="followUser"> + Follow! + </button> + </span> + </div> + </div> </div> </div> <div class="panel-body"> @@ -37,6 +55,21 @@ color: `#${this.user.profile_link_color}`, 'background-image': `url(${this.user.cover_photo})` } + }, + isOtherUser () { + return this.user !== this.$store.state.users.currentUser + } + }, + methods: { + followUser () { + const store = this.$store + store.state.api.backendInteractor.followUser(this.user.id) + .then((followedUser) => store.commit('addNewUsers', [followedUser])) + }, + unfollowUser () { + const store = this.$store + store.state.api.backendInteractor.unfollowUser(this.user.id) + .then((unfollowedUser) => store.commit('addNewUsers', [unfollowedUser])) } } } |
