feat: onthou link voor redirect naar login
This commit is contained in:
parent
6997e29da1
commit
c0b0e01eea
2 changed files with 16 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue