Refactor follower/friends out of statuses/timeline into user_profile where it

belongs. Changed display of profile to single panel with tabs.
This commit is contained in:
Henry Jameson 2018-12-17 19:14:38 +03:00
parent eaf065c751
commit 8f255fbad4
6 changed files with 110 additions and 83 deletions

View file

@ -51,6 +51,15 @@ export const mutations = {
endLogin (state) {
state.loggingIn = false
},
// TODO Clean after ourselves?
addFriends (state, { id, friends }) {
const user = state.usersObject[id]
user.friends = friends
},
addFollowers (state, { id, followers }) {
const user = state.usersObject[id]
user.followers = followers
},
addNewUsers (state, users) {
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
},
@ -92,6 +101,14 @@ const users = {
store.rootState.api.backendInteractor.fetchUser({ id })
.then((user) => store.commit('addNewUsers', [user]))
},
addFriends ({ rootState, commit }, { id }) {
rootState.api.backendInteractor.fetchFriends({ id })
.then((friends) => commit('addFriends', { id, friends }))
},
addFollowers ({ rootState, commit }, { id }) {
rootState.api.backendInteractor.fetchFollowers({ id })
.then((followers) => commit('addFollowers', { id, followers }))
},
registerPushNotifications (store) {
const token = store.state.currentUser.credentials
const vapidPublicKey = store.rootState.instance.vapidPublicKey