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
diff --git a/src/components/AppHeader/AppHeader.vue b/src/components/AppHeader/AppHeader.vue
index 8f00476..4eba752 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 @@
StatusIcon,
LoadingBar
},
+ mixins: [BVToastMixin],
data() {
return {
isNavigationOpen: false,
@@ -118,6 +120,9 @@
};
},
computed: {
+ isAuthorized() {
+ return this.$store.getters['global/isAuthorized'];
+ },
hostStatus() {
return this.$store.getters['global/hostStatus'];
},
@@ -153,6 +158,16 @@
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();