From 2af088969a26f8a3063336cc3885c10441087e81 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sat, 27 Apr 2019 09:36:10 -0400
Subject: [PATCH] improve error handling logic
---
src/components/extra_buttons/extra_buttons.js | 3 +++
src/components/status/status.js | 6 +++---
src/components/status/status.vue | 7 +++++--
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js
index 51892d0d..f70ecd1d 100644
--- a/src/components/extra_buttons/extra_buttons.js
+++ b/src/components/extra_buttons/extra_buttons.js
@@ -25,11 +25,14 @@ const ExtraButtons = {
pinStatus () {
this.refreshPopper()
this.$store.dispatch('pinStatus', this.status.id)
+ .then(() => this.$emit('onSuccess'))
.catch(err => this.$emit('onError', err.error.error))
},
unpinStatus () {
this.refreshPopper()
this.$store.dispatch('unpinStatus', this.status.id)
+ .then(() => this.$emit('onSuccess'))
+ .catch(err => this.$emit('onError', err.error.error))
},
refreshPopper () {
this.showPopper = false
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 09a2a010..a1ffb026 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -302,9 +302,9 @@ const Status = {
},
showError (error) {
this.error = error
- setTimeout(() => {
- this.error = null
- }, 5000)
+ },
+ clearError () {
+ this.error = undefined
},
linkClicked (event) {
let { target } = event
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index 77949a52..8575a95e 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -1,6 +1,9 @@
-
{{error}}
+
+ {{error}}
+
+
@@ -169,7 +172,7 @@
-
+