Fix loading single report page

This commit is contained in:
Angelina Filippova 2020-12-03 23:23:20 +03:00
parent 27a4620dba
commit 9913909cfa
2 changed files with 7 additions and 3 deletions

View file

@ -12,6 +12,7 @@ const reports = {
currentPage: 1, currentPage: 1,
fetchedReports: [], fetchedReports: [],
loading: true, loading: true,
loadingSingleReport: true,
openReportsCount: 0, openReportsCount: 0,
pageSize: 50, pageSize: 50,
singleReport: {}, singleReport: {},
@ -42,6 +43,9 @@ const reports = {
}, },
SET_SINGLE_REPORT: (state, report) => { SET_SINGLE_REPORT: (state, report) => {
state.singleReport = report state.singleReport = report
},
SET_SINGLE_REPORT_LOADING: (state, status) => {
state.loadingSingleReport = status
} }
}, },
actions: { actions: {
@ -162,11 +166,11 @@ const reports = {
commit('SET_LOADING', false) commit('SET_LOADING', false)
}, },
async FetchSingleReport({ commit, getters }, id) { async FetchSingleReport({ commit, getters }, id) {
commit('SET_LOADING', true) commit('SET_SINGLE_REPORT_LOADING', true)
const { data } = await fetchSingleReport(id, getters.authHost, getters.token) const { data } = await fetchSingleReport(id, getters.authHost, getters.token)
commit('SET_SINGLE_REPORT', data) commit('SET_SINGLE_REPORT', data)
commit('SET_LOADING', false) commit('SET_SINGLE_REPORT_LOADING', false)
}, },
async FetchOpenReportsCount({ commit, getters, state }) { async FetchOpenReportsCount({ commit, getters, state }) {
commit('SET_LOADING', true) commit('SET_LOADING', true)

View file

@ -47,7 +47,7 @@ export default {
components: { ModerateUserDropdown, RebootButton, ReportContent }, components: { ModerateUserDropdown, RebootButton, ReportContent },
computed: { computed: {
loading() { loading() {
return this.$store.state.reports.loading return this.$store.state.reports.loadingSingleReport
}, },
report() { report() {
return this.$store.state.reports.singleReport return this.$store.state.reports.singleReport