forked from AkkomaGang/admin-fe
Fix reports management
This commit is contained in:
parent
591e30f185
commit
b7c83e06a9
4 changed files with 11 additions and 7 deletions
|
@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
### Fixed
|
||||
|
||||
- Show checkmarks when tag is applied
|
||||
- Reports update (also, now it's optimistic)
|
||||
|
||||
## [1.2.0] - 2019-09-27
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ export async function filterReports(filter, limit, max_id, authHost, token) {
|
|||
}
|
||||
|
||||
export async function changeState(state, id, authHost, token) {
|
||||
const report = reports.find(report => report.id === id)
|
||||
return Promise.resolve({ data: { ...report, state }})
|
||||
return Promise.resolve({ data: '' })
|
||||
}
|
||||
|
||||
export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
|
||||
|
|
|
@ -5,10 +5,10 @@ import { baseName } from './utils'
|
|||
export async function changeState(state, id, authHost, token) {
|
||||
return await request({
|
||||
baseURL: baseName(authHost),
|
||||
url: `/api/pleroma/admin/reports/${id}`,
|
||||
method: 'put',
|
||||
url: `/api/pleroma/admin/reports`,
|
||||
method: 'patch',
|
||||
headers: authHeaders(token),
|
||||
data: { state }
|
||||
data: { reports: [{ id, state }] }
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,12 @@ const reports = {
|
|||
},
|
||||
actions: {
|
||||
async ChangeReportState({ commit, getters, state }, { reportState, reportId }) {
|
||||
const { data } = await changeState(reportState, reportId, getters.authHost, getters.token)
|
||||
const updatedReports = state.fetchedReports.map(report => report.id === reportId ? data : report)
|
||||
changeState(reportState, reportId, getters.authHost, getters.token)
|
||||
|
||||
const updatedReports = state.fetchedReports.map(report => {
|
||||
return report.id === reportId ? { ...report, state: reportState } : report
|
||||
})
|
||||
|
||||
commit('SET_REPORTS', updatedReports)
|
||||
},
|
||||
async ChangeStatusScope({ commit, getters, state }, { statusId, isSensitive, visibility, reportId }) {
|
||||
|
|
Loading…
Reference in a new issue