Skip to content
Snippets Groups Projects
Commit 8e7eb99f authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Update api that fetches statuses count

parent 3bedf77b
No related branches found
No related tags found
1 merge request!129Update status count when an instance was selected
This commit is part of merge request !129. Comments created here will be created in the context of that merge request.
......@@ -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)
})
......
......@@ -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', [])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment