Since BE doesn't support fetching user by screen name over MastoAPI we'll gonna
just fetching it over QvitterAPI real quick :DDDDDDDDD
This commit is contained in:
parent
853e0bc26f
commit
4f3a220487
10 changed files with 65 additions and 56 deletions
src/modules
|
@ -138,12 +138,7 @@ export const mutations = {
|
|||
}
|
||||
|
||||
export const getters = {
|
||||
userById: state => id =>
|
||||
state.users.find(user => user.id === id),
|
||||
userByName: state => name =>
|
||||
state.users.find(user => user.screen_name &&
|
||||
(user.screen_name.toLowerCase() === name.toLowerCase())
|
||||
)
|
||||
findUser: state => query => state.usersObject[query]
|
||||
}
|
||||
|
||||
export const defaultState = {
|
||||
|
@ -165,6 +160,11 @@ const users = {
|
|||
return store.rootState.api.backendInteractor.fetchUser({ id })
|
||||
.then((user) => store.commit('addNewUsers', [user]))
|
||||
},
|
||||
fetchUserByScreenName (store, screenName) {
|
||||
return store.rootState.api.backendInteractor.figureOutUserId({ screenName })
|
||||
.then((qvitterUserData) => store.rootState.api.backendInteractor.fetchUser({ id: qvitterUserData.id }))
|
||||
.then((user) => store.commit('addNewUsers', [user]) || user.id)
|
||||
},
|
||||
fetchUserRelationship (store, id) {
|
||||
return store.rootState.api.backendInteractor.fetchUserRelationship({ id })
|
||||
.then((relationships) => store.commit('updateUserRelationship', relationships))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue