summaryrefslogtreecommitdiff
path: root/src/store/api.js
diff options
context:
space:
mode:
authorDerick Montague <derick.montague@ibm.com>2019-12-23 22:33:52 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-01-29 01:18:05 +0300
commit126eaabea5edf8df4ed0dfb9c7af4ea246a5628a (patch)
tree87f92f49a660f9f77c13358b285a05b71e11c3dc /src/store/api.js
parent227c41a90d6146f4d0dd42f89df7f03efda895fa (diff)
downloadwebui-vue-126eaabea5edf8df4ed0dfb9c7af4ea246a5628a.tar.xz
Add interceptor for 403 response
This is a simple solution that is in parity with the current BMC functionality. Once we have mapped permissions, we can create a more elegant solution. Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: Id3ea36ba812462be04a450f84f98d0237d6c7c3d
Diffstat (limited to 'src/store/api.js')
-rw-r--r--src/store/api.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/store/api.js b/src/store/api.js
index 04caea12..4918d804 100644
--- a/src/store/api.js
+++ b/src/store/api.js
@@ -1,4 +1,5 @@
import Axios from 'axios';
+import router from '../router';
const api = Axios.create({
withCredentials: true
@@ -6,10 +7,15 @@ const api = Axios.create({
api.interceptors.response.use(undefined, error => {
let response = error.response;
+
// TODO: Provide user with a notification and way to keep system active
if (response.status == 401) {
window.location = '/login';
}
+
+ if (response.status == 403) {
+ router.push({ name: 'unauthorized' });
+ }
});
export default {