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

File diff suppressed because it is too large Load Diff

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})

View File

@@ -73,14 +73,22 @@ export default createStore({
if ('next' in router.currentRoute.value.query) {
router.push(router.currentRoute.value.query.next)
} else {
router.push('/')
router.push('browse')
}
})
.catch((error)=>{
// console.log(error);
const $toast = useToast();
if (error.response.data.detail) {
$toast.error(error.response.data.detail, {position:'top'});
}
if (error.response.data.username) {
$toast.error("Username: " + error.response.data.username, {position:'top'});
}
if (error.response.data.password) {
$toast.error("Password: " + error.response.data.password, {position:'top'});
}
})
},
refreshToken(){

View File

@@ -3,7 +3,7 @@
<div class="row" v-if="!initialSetupRequired">
<div class="col col-lg-4" />
<div class="col col-lg-4" id="login-col">
<form @submit="login">
<form @submit="login" v-on:submit.prevent="onSubmit">
<label class="form-label" for="username">Username</label>
<input id="username" placeholder="username" aria-describedby="loginFormControlInputHelpInline" class="form-control" type="text" v-model="username" />
<div class="form-text" id="loginFormControlInputHelpInline">Please enter your username</div>