Add unfollowing.

This commit is contained in:
Roger Braun 2016-12-23 16:45:57 +01:00
parent 2088b3c4dd
commit 8f494b14f0
3 changed files with 23 additions and 1 deletions

View file

@ -13,6 +13,9 @@
<div class="followed">
<span v-if="user.following">
Following them!
<button @click="unfollowUser">
Unfollow!
</button>
</span>
<span v-if="!user.following" >
<button @click="followUser">
@ -62,6 +65,11 @@
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]))
}
}
}