diff options
| author | shpuld <shp@cock.li> | 2018-12-20 22:20:04 +0200 |
|---|---|---|
| committer | shpuld <shp@cock.li> | 2018-12-20 22:20:04 +0200 |
| commit | 67263cde05cacd6bf2a8941cce4c562ef88977e4 (patch) | |
| tree | e2c16bcb643d6286752672ec92db73be7e86bb21 /src/modules/users.js | |
| parent | 640a28789222035f8d500b8dd4bfc4c9f0cdd1af (diff) | |
| parent | 562c68a51c9746650fabfc5c641816396439c791 (diff) | |
works but hacky
Diffstat (limited to 'src/modules/users.js')
| -rw-r--r-- | src/modules/users.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/modules/users.js b/src/modules/users.js index 65b172bc..31fe94fc 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -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 |
