Update api that fetches statuses count

This commit is contained in:
Angelina Filippova 2020-05-10 18:49:11 +03:00
parent 3bedf77b44
commit 8e7eb99f1f
2 changed files with 6 additions and 4 deletions

View file

@ -30,10 +30,10 @@ export async function fetchStatuses({ godmode, localOnly, authHost, token, pageS
})
}
export async function fetchStatusesCount(authHost, token) {
export async function fetchStatusesCount(instance, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/stats`,
url: instance ? `/api/pleroma/admin/stats?instance=${instance}` : `/api/pleroma/admin/stats`,
method: 'get',
headers: authHeaders(token)
})

View file

@ -68,13 +68,15 @@ const status = {
dispatch('FetchStatusesByInstance')
}
},
async FetchStatusesCount({ commit, getters }) {
async FetchStatusesCount({ commit, getters }, instance) {
commit('SET_LOADING', true)
const { data } = await fetchStatusesCount(getters.authHost, getters.token)
const { data } = await fetchStatusesCount(instance, getters.authHost, getters.token)
commit('SET_STATUS_VISIBILITY', data.status_visibility)
commit('SET_LOADING', false)
},
async FetchStatusesByInstance({ commit, getters, state, rootState }) {
const { data } = await fetchStatusesCount(state.statusesByInstance.selectedInstance, getters.authHost, getters.token)
commit('SET_STATUS_VISIBILITY', data.status_visibility)
commit('SET_LOADING', true)
if (state.statusesByInstance.selectedInstance === '') {
commit('SET_STATUSES_BY_INSTANCE', [])