correctly update relationship on follow/unfollow

This commit is contained in:
Henry Jameson 2019-03-25 21:19:24 +02:00
parent 82f077feb9
commit d766059dee

View file

@ -19,7 +19,7 @@ const fetchUser = (attempt, user, store) => new Promise((resolve, reject) => {
export const requestFollow = (user, store) => new Promise((resolve, reject) => { export const requestFollow = (user, store) => new Promise((resolve, reject) => {
store.state.api.backendInteractor.followUser(user.id) store.state.api.backendInteractor.followUser(user.id)
.then((updated) => { .then((updated) => {
store.commit('addNewUsers', [updated]) store.commit('updateUserRelationship', [updated])
// For locked users we just mark it that we sent the follow request // For locked users we just mark it that we sent the follow request
if (updated.locked) { if (updated.locked) {
@ -66,7 +66,7 @@ export const requestFollow = (user, store) => new Promise((resolve, reject) => {
export const requestUnfollow = (user, store) => new Promise((resolve, reject) => { export const requestUnfollow = (user, store) => new Promise((resolve, reject) => {
store.state.api.backendInteractor.unfollowUser(user.id) store.state.api.backendInteractor.unfollowUser(user.id)
.then((updated) => { .then((updated) => {
store.commit('addNewUsers', [updated]) store.commit('updateUserRelationship', [updated])
resolve({ resolve({
updated updated
}) })