diff --git a/src/api/status.js b/src/api/status.js index 37f7e0c2..fcc820e0 100644 --- a/src/api/status.js +++ b/src/api/status.js @@ -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), diff --git a/src/store/modules/status.js b/src/store/modules/status.js index e0cc5d97..8847e8bf 100644 --- a/src/store/modules/status.js +++ b/src/store/modules/status.js @@ -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 === '') {