mirror of
https://github.com/ajurna/cbwebreader.git
synced 2025-12-06 14:17:19 +00:00
library bumps
fix for LoginView.vue reloading instead of logging in. improved errors for login failing misc cleanup.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user