Update reactivity in action that fetches user statuses
This commit is contained in:
parent
63ad2f4524
commit
372d37e3b3
2 changed files with 8 additions and 5 deletions
|
@ -65,7 +65,7 @@ const status = {
|
||||||
} else if (fetchStatusesByInstance) { // called from Statuses by Instance
|
} else if (fetchStatusesByInstance) { // called from Statuses by Instance
|
||||||
dispatch('FetchStatusesByInstance')
|
dispatch('FetchStatusesByInstance')
|
||||||
} else { // called from Status show page
|
} else { // called from Status show page
|
||||||
dispatch('FetchStatus', statusId)
|
dispatch('FetchStatusAfterUserModeration', statusId)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ClearState({ commit }) {
|
ClearState({ commit }) {
|
||||||
|
@ -98,7 +98,7 @@ const status = {
|
||||||
FetchStatusAfterUserModeration({ commit, dispatch, getters, state }, id) {
|
FetchStatusAfterUserModeration({ commit, dispatch, getters, state }, id) {
|
||||||
commit('SET_LOADING', true)
|
commit('SET_LOADING', true)
|
||||||
fetchStatus(id, getters.authHost, getters.token)
|
fetchStatus(id, getters.authHost, getters.token)
|
||||||
.then((status) => dispatch('SetStatus', status.data))
|
.then(status => dispatch('SetStatus', status.data))
|
||||||
commit('SET_LOADING', false)
|
commit('SET_LOADING', false)
|
||||||
},
|
},
|
||||||
async FetchStatusesCount({ commit, getters }, instance) {
|
async FetchStatusesCount({ commit, getters }, instance) {
|
||||||
|
|
|
@ -35,18 +35,21 @@ const userProfile = {
|
||||||
|
|
||||||
dispatch('FetchUserStatuses', { userId, godmode })
|
dispatch('FetchUserStatuses', { userId, godmode })
|
||||||
},
|
},
|
||||||
async FetchUserStatuses({ commit, getters }, { userId, godmode }) {
|
FetchUserStatuses({ commit, dispatch, getters }, { userId, godmode }) {
|
||||||
commit('SET_STATUSES_LOADING', true)
|
commit('SET_STATUSES_LOADING', true)
|
||||||
|
|
||||||
const statuses = await fetchUserStatuses(userId, getters.authHost, godmode, getters.token)
|
fetchUserStatuses(userId, getters.authHost, godmode, getters.token)
|
||||||
|
.then(statuses => dispatch('SetStatuses', statuses.data))
|
||||||
|
|
||||||
commit('SET_STATUSES', statuses.data)
|
|
||||||
commit('SET_STATUSES_LOADING', false)
|
commit('SET_STATUSES_LOADING', false)
|
||||||
},
|
},
|
||||||
async FetchUserCredentials({ commit, getters }, { nickname }) {
|
async FetchUserCredentials({ commit, getters }, { nickname }) {
|
||||||
const userResponse = await fetchUserCredentials(nickname, getters.authHost, getters.token)
|
const userResponse = await fetchUserCredentials(nickname, getters.authHost, getters.token)
|
||||||
commit('SET_USER_CREDENTIALS', userResponse.data)
|
commit('SET_USER_CREDENTIALS', userResponse.data)
|
||||||
},
|
},
|
||||||
|
SetStatuses({ commit }, statuses) {
|
||||||
|
commit('SET_STATUSES', statuses)
|
||||||
|
},
|
||||||
async UpdateUserCredentials({ dispatch, getters }, { nickname, credentials }) {
|
async UpdateUserCredentials({ dispatch, getters }, { nickname, credentials }) {
|
||||||
await updateUserCredentials(nickname, credentials, getters.authHost, getters.token)
|
await updateUserCredentials(nickname, credentials, getters.authHost, getters.token)
|
||||||
dispatch('FetchUserCredentials', { nickname })
|
dispatch('FetchUserCredentials', { nickname })
|
||||||
|
|
Loading…
Reference in a new issue