remove deprecations, remove header when scrolling

This commit is contained in:
2026-07-04 17:06:45 +02:00
parent a73a1b57de
commit 0e3142bac9
4 changed files with 201 additions and 20 deletions
+7 -17
View File
@@ -31,23 +31,13 @@ const router = createRouter({
]
})
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth) {
let isAuthenticated = false;
if (localStorage.getItem("user-token") != null){
isAuthenticated = true;
}
if (!isAuthenticated) {
// Redirect to the login page
next('/login');
} else {
// Proceed to the protected route
next();
}
} else {
// For routes that don't require authentication, proceed without checking
next();
router.beforeEach((to) => {
const isAuthenticated = localStorage.getItem("user-token") != null;
// Redirect unauthenticated users hitting a protected route to login;
// returning a value (instead of the deprecated next() callback) is the
// modern vue-router guard API. Returning nothing lets navigation proceed.
if (to.meta.requiresAuth && !isAuthenticated) {
return '/login';
}
});
export default router