summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'src/store')
-rw-r--r--src/store/api.js6
-rw-r--r--src/store/modules/Authentication/AuthenticanStore.js5
2 files changed, 9 insertions, 2 deletions
diff --git a/src/store/api.js b/src/store/api.js
index 4918d804..0f8c9484 100644
--- a/src/store/api.js
+++ b/src/store/api.js
@@ -10,12 +10,16 @@ api.interceptors.response.use(undefined, error => {
// TODO: Provide user with a notification and way to keep system active
if (response.status == 401) {
- window.location = '/login';
+ if (response.config.url != '/login') {
+ window.location = '/login';
+ }
}
if (response.status == 403) {
router.push({ name: 'unauthorized' });
}
+
+ return Promise.reject(error);
});
export default {
diff --git a/src/store/modules/Authentication/AuthenticanStore.js b/src/store/modules/Authentication/AuthenticanStore.js
index 88456e95..3a554b6b 100644
--- a/src/store/modules/Authentication/AuthenticanStore.js
+++ b/src/store/modules/Authentication/AuthenticanStore.js
@@ -13,7 +13,7 @@ const AuthenticationStore = {
},
mutations: {
authRequest(state) {
- state.status = 'loading';
+ state.status = 'processing';
},
authSuccess(state) {
state.status = 'authenticated';
@@ -22,6 +22,9 @@ const AuthenticationStore = {
authError(state) {
state.status = 'error';
},
+ authReset(state) {
+ state.status = '';
+ },
logout(state) {
state.status = '';
Cookies.remove('XSRF-TOKEN');