feat: review backend and frontend
- update to the latest version of Java/SpringBoot - update to the latest version NuxtJS - add account/password update - add account creation - add account password reset - add bundle to regroup questions and add default questions on user creation - add bundle creation
This commit is contained in:
22
frontend/middleware/auth.global.ts
Normal file
22
frontend/middleware/auth.global.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {useAuthStore} from "~/store/auth";
|
||||
|
||||
const publicUrl = [
|
||||
"index",
|
||||
"login",
|
||||
"account-password-reset",
|
||||
"account-password-confirm-reset",
|
||||
"account-create",
|
||||
"cgu"
|
||||
]
|
||||
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
const store = useAuthStore();
|
||||
if (store.authenticated && to?.name === 'login') {
|
||||
return navigateTo('/bundle');
|
||||
}
|
||||
// if token doesn't exist redirect to log in if not in public URL
|
||||
if (!store.authenticated && !publicUrl.includes(to?.name)) {
|
||||
abortNavigation();
|
||||
return navigateTo('/login');
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user