summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/router/index.js8
-rw-r--r--src/store/api.js6
-rw-r--r--src/views/Unauthorized/Unauthorized.vue20
-rw-r--r--src/views/Unauthorized/index.js2
4 files changed, 36 insertions, 0 deletions
diff --git a/src/router/index.js b/src/router/index.js
index cbebca70..61cb9023 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -28,6 +28,14 @@ const routes = [
meta: {
title: 'Local user management'
}
+ },
+ {
+ path: '/unauthorized',
+ name: 'unauthorized',
+ component: () => import('@/views/Unauthorized'),
+ meta: {
+ title: 'Unauthorized'
+ }
}
]
},
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 {
diff --git a/src/views/Unauthorized/Unauthorized.vue b/src/views/Unauthorized/Unauthorized.vue
new file mode 100644
index 00000000..446270d7
--- /dev/null
+++ b/src/views/Unauthorized/Unauthorized.vue
@@ -0,0 +1,20 @@
+<template>
+ <div>
+ <PageTitle :description="description" />
+ </div>
+</template>
+<script>
+import PageTitle from '../../components/Global/PageTitle';
+export default {
+ name: 'Unauthorized',
+ components: {
+ PageTitle
+ },
+ data() {
+ return {
+ description:
+ 'The attempted action is not accessible from the logged in account. Contact your system administrator to check your privilege role.'
+ };
+ }
+};
+</script>
diff --git a/src/views/Unauthorized/index.js b/src/views/Unauthorized/index.js
new file mode 100644
index 00000000..4b4364bf
--- /dev/null
+++ b/src/views/Unauthorized/index.js
@@ -0,0 +1,2 @@
+import Unauthorized from './Unauthorized.vue';
+export default Unauthorized;