Add api function and action that fetches statuses count by scope
This commit is contained in:
parent
2d30331fdf
commit
4f61344c50
2 changed files with 21 additions and 2 deletions
|
@ -30,6 +30,15 @@ export async function fetchStatuses({ godmode, localOnly, authHost, token, pageS
|
|||
})
|
||||
}
|
||||
|
||||
export async function fetchStatusesCount(authHost, token) {
|
||||
return await request({
|
||||
baseURL: baseName(authHost),
|
||||
url: `/api/pleroma/admin/stats`,
|
||||
method: 'get',
|
||||
headers: authHeaders(token)
|
||||
})
|
||||
}
|
||||
|
||||
export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) {
|
||||
return await request({
|
||||
baseURL: baseName(authHost),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { changeStatusScope, deleteStatus, fetchStatuses, fetchStatusesByInstance } from '@/api/status'
|
||||
import { changeStatusScope, deleteStatus, fetchStatuses, fetchStatusesCount, fetchStatusesByInstance } from '@/api/status'
|
||||
|
||||
const status = {
|
||||
state: {
|
||||
|
@ -12,7 +12,8 @@ const status = {
|
|||
pageSize: 20,
|
||||
buttonLoading: false,
|
||||
allLoaded: false
|
||||
}
|
||||
},
|
||||
statusVisibility: {}
|
||||
},
|
||||
mutations: {
|
||||
CHANGE_GODMODE_CHECKBOX_VALUE: (state, value) => {
|
||||
|
@ -41,6 +42,9 @@ const status = {
|
|||
},
|
||||
SET_LOADING: (state, status) => {
|
||||
state.loading = status
|
||||
},
|
||||
SET_STATUS_VISIBILITY: (state, visibility) => {
|
||||
state.statusVisibility = visibility
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
@ -64,6 +68,12 @@ const status = {
|
|||
dispatch('FetchStatusesByInstance')
|
||||
}
|
||||
},
|
||||
async FetchStatusesCount({ commit, getters }) {
|
||||
commit('SET_LOADING', true)
|
||||
const { data } = await fetchStatusesCount(getters.authHost, getters.token)
|
||||
commit('SET_STATUS_VISIBILITY', data.status_visibility)
|
||||
commit('SET_LOADING', false)
|
||||
},
|
||||
async FetchStatusesByInstance({ commit, getters, state, rootState }) {
|
||||
commit('SET_LOADING', true)
|
||||
if (state.statusesByInstance.selectedInstance === '') {
|
||||
|
|
Loading…
Reference in a new issue