removed vuejs logger completely, upgraded to vue 4.x validation not yet working
This commit is contained in:
@@ -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 = '/';
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,7 +24,8 @@ export function authenticate(userData: any) {
|
||||
}
|
||||
|
||||
export function revokeRefreshKey(jwt: any) {
|
||||
return axios.post(`${API_URL}/auth/revokeRefreshToken`, { headers: { Authorization: `Bearer ${jwt}` } });
|
||||
//return axios.post(`${API_URL}/auth/revokeRefreshToken`, { headers: { Authorization: `Bearer ${jwt}` } });
|
||||
return axios.get(`${API_URL}/auth/revokeRefreshToken`, { headers: { Authorization: `Bearer ${jwt}` } });
|
||||
}
|
||||
|
||||
export function register(userData: any) {
|
||||
@@ -62,7 +63,6 @@ export function fetchUserGroup(jwt: any, groupId: any) {
|
||||
}
|
||||
|
||||
export function fetchProfile(jwt: any) {
|
||||
Vue.$log.debug('JWT: ' + jwt);
|
||||
return axios.get(`${API_URL}/v1/user/profile`, { headers: { Authorization: `Bearer ${jwt}` } });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user