From d611c7d0e54e653e8b4249b789724a4f88ab1602 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 27 Feb 2020 22:25:50 +0300 Subject: [PATCH] Add api function and action to fetch statuses --- CHANGELOG.md | 6 ++++++ src/api/status.js | 9 +++++++++ src/store/getters.js | 4 +--- src/store/modules/status.js | 7 ++++++- src/views/statuses/index.vue | 11 ++++++----- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd8927e..bdefcea9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased + +### Added + +- Ability to see local statuses in Statuses by instance section + ## [2.0] - 2020-02-27 ### Added diff --git a/src/api/status.js b/src/api/status.js index 676cd9dc..9feb8754 100644 --- a/src/api/status.js +++ b/src/api/status.js @@ -21,6 +21,15 @@ export async function deleteStatus(id, authHost, token) { }) } +export async function fetchStatuses({ godmode, localOnly, authHost, token }) { + return await request({ + baseURL: baseName(authHost), + url: `/api/pleroma/admin/statuses?godmode=${godmode}&local_only=${localOnly}`, + 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/getters.js b/src/store/getters.js index d51dbd28..f58f0c6b 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -17,8 +17,6 @@ const getters = { errorLogs: state => state.errorLog.logs, users: state => state.users.fetchedUsers, authHost: state => state.user.authHost, - settings: state => state.settings, - instances: state => state.peers.fetchedPeers, - statuses: state => state.status.fetchedStatuses + settings: state => state.settings } export default getters diff --git a/src/store/modules/status.js b/src/store/modules/status.js index 81e86dba..7f547d34 100644 --- a/src/store/modules/status.js +++ b/src/store/modules/status.js @@ -1,4 +1,4 @@ -import { changeStatusScope, deleteStatus, fetchStatusesByInstance } from '@/api/status' +import { changeStatusScope, deleteStatus, fetchStatuses, fetchStatusesByInstance } from '@/api/status' const status = { state: { @@ -48,6 +48,11 @@ const status = { dispatch('FetchStatusesByInstance') } }, + async FetchStatuses({ commit, getters }, { godmode, localOnly }) { + commit('SET_LOADING', true) + await fetchStatuses({ godmode, localOnly, authHost: getters.authHost, token: getters.token }) + commit('SET_LOADING', false) + }, async FetchStatusesByInstance({ commit, getters, state }) { commit('SET_LOADING', true) const statuses = state.statusesByInstance.selectedInstance === '' diff --git a/src/views/statuses/index.vue b/src/views/statuses/index.vue index b6fd2019..7ecd649f 100644 --- a/src/views/statuses/index.vue +++ b/src/views/statuses/index.vue @@ -36,7 +36,6 @@