feat: onthou link voor redirect naar login

This commit is contained in:
Gabriellvl 2025-05-14 11:01:04 +02:00
parent 6997e29da1
commit c0b0e01eea
2 changed files with 16 additions and 1 deletions

View file

@ -143,6 +143,10 @@ router.beforeEach(async (to, _from, next) => {
// Verify if user is logged in before accessing certain routes
if (to.meta.requiresAuth) {
if (!authService.isLoggedIn.value && !(await authService.loadUser())) {
const path = to.fullPath
if (path !== "/") {
localStorage.setItem("redirectAfterLogin", path);
}
next("/login");
} else {
next();