removed vuejs logger completely, upgraded to vue 4.x validation not yet working

This commit is contained in:
2020-07-30 16:42:32 +02:00
parent 0a885f1750
commit d26cc1492d
23 changed files with 5436 additions and 2354 deletions

View File

@@ -16,7 +16,6 @@ api.interceptors.request.use(async function(config) {
const token = store.state.access_token;
config.headers.Authorization = `Bearer ${token}`;
} else {
Vue.$log.warn("the access_token is not valid anymore.");
if(store.getters.isRefreshTokenValid){
await store.dispatch('refreshToken');
const token = store.state.access_token;
@@ -25,7 +24,6 @@ api.interceptors.request.use(async function(config) {
const token = store.state.access_token;
config.headers.Authorization = `Bearer ${token}`;
}).catch( () => {
Vue.$log.error("Could not refresh tokens!");
window.location = '/login';
});*/
} else {
@@ -38,10 +36,8 @@ api.interceptors.request.use(async function(config) {
confirmButtonText: "Yes",
}).then( (result) => {
if(result.value) {
Vue.$log.info("redirect to login!");
window.location = '/login';
} else {
Vue.$log.info("redirect to home!");
window.location = '/';
}
});
@@ -51,12 +47,9 @@ api.interceptors.request.use(async function(config) {
});
api.interceptors.response.use(function (response) {
Vue.$log.debug("Token OK: " + store.state.access_token);
return response;
}, function (error) {
if (401 === error.response.status || 422 === error.response.status) {
Vue.$log.warn("Invalid / no access token?!");
Vue.$log.debug(store.state.access_token);
Vue.swal({
title: "Session Expired",
text: "Your token/session has expired. Would you like to be redirected to the login page?",
@@ -66,10 +59,8 @@ api.interceptors.response.use(function (response) {
confirmButtonText: "Yes",
}).then( (result) => {
if(result.value) {
Vue.$log.info("redirect to login!");
window.location = '/login';
} else {
Vue.$log.info("redirect to home!");
window.location = '/';
}
});