From 06f795d1d656d18d87015e3a52e090d6396a03ab Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Wed, 27 Jan 2021 13:13:10 +0200 Subject: [PATCH] add proper state switcher --- src/components/report/report.js | 9 ++++-- src/components/report/report.scss | 6 +++- src/components/report/report.vue | 47 +++++++++++++++---------------- src/modules/reports.js | 7 +++-- src/services/api/api.service.js | 7 +---- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/components/report/report.js b/src/components/report/report.js index 8131dd89..4d9108af 100644 --- a/src/components/report/report.js +++ b/src/components/report/report.js @@ -13,14 +13,19 @@ const Report = { computed: { report () { return this.$store.state.reports.reports[this.reportId] || {} + }, + state: { + get: function () { return this.report.state }, + set: function (val) { this.setReportState(val) } } }, methods: { generateUserProfileLink (user) { return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames) }, - setReportState (id, state) { - return this.$store.dispatch('setReportState', { id, state }) + setReportState (state) { + console.log('setting state', state) + return this.$store.dispatch('setReportState', { id: this.report.id, state }) } } } diff --git a/src/components/report/report.scss b/src/components/report/report.scss index 7e9cc2b6..578b4eb1 100644 --- a/src/components/report/report.scss +++ b/src/components/report/report.scss @@ -2,7 +2,11 @@ .Report { .report-content { - margin: 0.5em 0; + margin: 0.5em 0 1em; + } + + .report-state { + margin: 0.5em 0 1em; } .reported-status { diff --git a/src/components/report/report.vue b/src/components/report/report.vue index 638a3aa0..4020773d 100644 --- a/src/components/report/report.vue +++ b/src/components/report/report.vue @@ -1,29 +1,5 @@