aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_reporting_modal
diff options
context:
space:
mode:
authortaehoon <th.dev91@gmail.com>2019-03-20 12:37:13 -0400
committertaehoon <th.dev91@gmail.com>2019-05-03 11:40:05 -0400
commit471085f0f36e91daa74938e34ad738a86849894a (patch)
tree159b4dd4a120d7c5f9cf077cbf79a78b917fb2da /src/components/user_reporting_modal
parentdfc56dfee25a178e757f5d0b9d0d111a43083eab (diff)
add error message
Diffstat (limited to 'src/components/user_reporting_modal')
-rw-r--r--src/components/user_reporting_modal/user_reporting_modal.js12
-rw-r--r--src/components/user_reporting_modal/user_reporting_modal.vue7
2 files changed, 18 insertions, 1 deletions
diff --git a/src/components/user_reporting_modal/user_reporting_modal.js b/src/components/user_reporting_modal/user_reporting_modal.js
index 6b1177b9..34a87720 100644
--- a/src/components/user_reporting_modal/user_reporting_modal.js
+++ b/src/components/user_reporting_modal/user_reporting_modal.js
@@ -12,7 +12,8 @@ const UserReportingModal = {
comment: '',
forward: false,
statusIdsToReport: [],
- processing: false
+ processing: false,
+ error: false
}
},
computed: {
@@ -45,12 +46,14 @@ const UserReportingModal = {
this.forward = false
this.statusIdsToReport = []
this.processing = false
+ this.error = false
},
closeModal () {
this.$store.dispatch('closeUserReportingModal')
},
reportUser () {
this.processing = true
+ this.error = false
const params = {
userId: this.userId,
comment: this.comment,
@@ -63,6 +66,13 @@ const UserReportingModal = {
this.resetState()
this.closeModal()
})
+ .catch(() => {
+ this.processing = false
+ this.error = true
+ })
+ },
+ clearError () {
+ this.error = false
},
isChecked (statusId) {
return this.statusIdsToReport.indexOf(statusId) !== -1
diff --git a/src/components/user_reporting_modal/user_reporting_modal.vue b/src/components/user_reporting_modal/user_reporting_modal.vue
index 30d3ab19..eae97900 100644
--- a/src/components/user_reporting_modal/user_reporting_modal.vue
+++ b/src/components/user_reporting_modal/user_reporting_modal.vue
@@ -20,6 +20,9 @@
</div>
<div>
<button class="btn btn-default" @click="reportUser" :disabled="processing">Submit</button>
+ <div class="alert error" v-if="error">
+ An error occured processing your request
+ </div>
</div>
</div>
<div class="user-reporting-panel-right">
@@ -84,6 +87,10 @@
min-width: 10em;
padding: 0 2em;
}
+
+ .alert {
+ margin: 1em 0 0 0;
+ }
}
&-right {