From dd6aa0aa8f12426c681f5991f2e9a21b379e86c3 Mon Sep 17 00:00:00 2001
From: Sukanya Pandey <sukapan1@in.ibm.com>
Date: Thu, 8 Oct 2020 20:47:39 +0530
Subject: Show error toast notification on unauthorized access

 -When 403 status code which is an unauthorized access occured
 -show error toast notification.

Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: I55fa7052073f87f28c3584b68fd4e84247a4237e
---
 src/components/AppHeader/AppHeader.vue | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'src/components/AppHeader/AppHeader.vue')

diff --git a/src/components/AppHeader/AppHeader.vue b/src/components/AppHeader/AppHeader.vue
index 8f004762..4eba7522 100644
--- a/src/components/AppHeader/AppHeader.vue
+++ b/src/components/AppHeader/AppHeader.vue
@@ -94,6 +94,7 @@
 </template>
 
 <script>
+import BVToastMixin from '@/components/Mixins/BVToastMixin';
 import IconAvatar from '@carbon/icons-vue/es/user--avatar/20';
 import IconClose from '@carbon/icons-vue/es/close/20';
 import IconMenu from '@carbon/icons-vue/es/menu/20';
@@ -111,6 +112,7 @@ export default {
     StatusIcon,
     LoadingBar
   },
+  mixins: [BVToastMixin],
   data() {
     return {
       isNavigationOpen: false,
@@ -118,6 +120,9 @@ export default {
     };
   },
   computed: {
+    isAuthorized() {
+      return this.$store.getters['global/isAuthorized'];
+    },
     hostStatus() {
       return this.$store.getters['global/hostStatus'];
     },
@@ -153,6 +158,16 @@ export default {
       return this.$store.getters['global/username'];
     }
   },
+  watch: {
+    isAuthorized(value) {
+      if (value === false) {
+        this.errorToast(
+          this.$t('global.toast.unAuthDescription'),
+          this.$t('global.toast.unAuthTitle')
+        );
+      }
+    }
+  },
   created() {
     this.getHostInfo();
     this.getEvents();
-- 
cgit v1.2.3

