library bumps

fix for LoginView.vue reloading instead of logging in.
improved errors for login failing
misc cleanup.
This commit is contained in:
Peter Dwyer
2023-02-07 14:39:26 +00:00
parent 84eec0c0bf
commit 1fbe359448
4 changed files with 726 additions and 444 deletions

View File

@@ -8,7 +8,7 @@ async function get_access_token() {
let refresh = jwtDecode(store.state.jwt.refresh)
if (access.exp - Date.now()/1000 < 5) {
if (refresh.exp - Date.now()/1000 < 5) {
await router.push({name: 'login', params: { username: 'eduardo' }})
await router.push({name: 'login'})
return null
} else {
return store.dispatch('refreshToken').then(() => {return store.state.jwt.access})
@@ -22,9 +22,9 @@ const axios_jwt = axios.create();
axios_jwt.interceptors.request.use(async function (config) {
let access_token = await get_access_token().catch(() => {
if (router.currentRoute.value.fullPath.includes('login')){
router.push({name: 'login'})
router.push({name: 'login'})
}else {
router.push({name: 'login', query: { next: router.currentRoute.value.fullPath }})
router.push({name: 'login', query: { next: router.currentRoute.value.fullPath }})
}
})
@@ -32,9 +32,9 @@ axios_jwt.interceptors.request.use(async function (config) {
Authorization: "Bearer " + access_token
}
return config
}, function (error) {
}, function (error) {
// Do something with request error
return Promise.reject(error);
});
});
export default axios_jwt
export default axios_jwt