summaryrefslogtreecommitdiff
path: root/src/store/modules
diff options
context:
space:
mode:
authorSukanya Pandey <sukapan1@in.ibm.com>2020-10-08 18:17:39 +0300
committerDerick Montague <derick.montague@ibm.com>2020-10-21 00:34:04 +0300
commitdd6aa0aa8f12426c681f5991f2e9a21b379e86c3 (patch)
tree3297232b18559392eb193068022ce6d99412e227 /src/store/modules
parenta11cedb53a540b7455a8169b74b62009b5982b7d (diff)
downloadwebui-vue-dd6aa0aa8f12426c681f5991f2e9a21b379e86c3.tar.xz
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
Diffstat (limited to 'src/store/modules')
-rw-r--r--src/store/modules/GlobalStore.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
index 03301538..5af5dfe6 100644
--- a/src/store/modules/GlobalStore.js
+++ b/src/store/modules/GlobalStore.js
@@ -35,14 +35,16 @@ const GlobalStore = {
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 @@ const GlobalStore = {
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 }) {