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/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
index 0330153..5af5dfe 100644
--- a/src/store/modules/GlobalStore.js
+++ b/src/store/modules/GlobalStore.js
@@ -35,14 +35,16 @@
isUtcDisplay: localStorage.getItem('storedUtcDisplay')
? JSON.parse(localStorage.getItem('storedUtcDisplay'))
: true,
- username: localStorage.getItem('storedUsername')
+ username: localStorage.getItem('storedUsername'),
+ isAuthorized: true
},
getters: {
hostStatus: state => state.hostStatus,
bmcTime: state => state.bmcTime,
languagePreference: state => state.languagePreference,
isUtcDisplay: state => state.isUtcDisplay,
- username: state => state.username
+ username: state => state.username,
+ isAuthorized: state => state.isAuthorized
},
mutations: {
setBmcTime: (state, bmcTime) => (state.bmcTime = bmcTime),
@@ -51,7 +53,13 @@
setLanguagePreference: (state, language) =>
(state.languagePreference = language),
setUsername: (state, username) => (state.username = username),
- setUtcTime: (state, isUtcDisplay) => (state.isUtcDisplay = isUtcDisplay)
+ setUtcTime: (state, isUtcDisplay) => (state.isUtcDisplay = isUtcDisplay),
+ setUnauthorized: state => {
+ state.isAuthorized = false;
+ window.setTimeout(() => {
+ state.isAuthorized = true;
+ }, 100);
+ }
},
actions: {
async getBmcTime({ commit }) {