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
|
### Fixed
|
||||||
|
|
||||||
- Show checkmarks when tag is applied
|
- Show checkmarks when tag is applied
|
||||||
|
- Reports update (also, now it's optimistic)
|
||||||
|
|
||||||
## [1.2.0] - 2019-09-27
|
## [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) {
|
export async function changeState(state, id, authHost, token) {
|
||||||
const report = reports.find(report => report.id === id)
|
return Promise.resolve({ data: '' })
|
||||||
return Promise.resolve({ data: { ...report, state }})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
|
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) {
|
export async function changeState(state, id, authHost, token) {
|
||||||
return await request({
|
return await request({
|
||||||
baseURL: baseName(authHost),
|
baseURL: baseName(authHost),
|
||||||
url: `/api/pleroma/admin/reports/${id}`,
|
url: `/api/pleroma/admin/reports`,
|
||||||
method: 'put',
|
method: 'patch',
|
||||||
headers: authHeaders(token),
|
headers: authHeaders(token),
|
||||||
data: { state }
|
data: { reports: [{ id, state }] }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,12 @@ const reports = {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async ChangeReportState({ commit, getters, state }, { reportState, reportId }) {
|
async ChangeReportState({ commit, getters, state }, { reportState, reportId }) {
|
||||||
const { data } = await changeState(reportState, reportId, getters.authHost, getters.token)
|
changeState(reportState, reportId, getters.authHost, getters.token)
|
||||||
const updatedReports = state.fetchedReports.map(report => report.id === reportId ? data : report)
|
|
||||||
|
const updatedReports = state.fetchedReports.map(report => {
|
||||||
|
return report.id === reportId ? { ...report, state: reportState } : report
|
||||||
|
})
|
||||||
|
|
||||||
commit('SET_REPORTS', updatedReports)
|
commit('SET_REPORTS', updatedReports)
|
||||||
},
|
},
|
||||||
async ChangeStatusScope({ commit, getters, state }, { statusId, isSensitive, visibility, reportId }) {
|
async ChangeStatusScope({ commit, getters, state }, { statusId, isSensitive, visibility, reportId }) {
|
||||||
|
|
Loading…
Reference in a new issue