fix(frontend): 'requiresAuth' routes niet meer zonder authenticatie toegankelijk
This commit is contained in:
		
							parent
							
								
									b8e63e3e34
								
							
						
					
					
						commit
						f94b7808f7
					
				
					 4 changed files with 4 additions and 10 deletions
				
			
		|  | @ -139,15 +139,14 @@ const router = createRouter({ | |||
|             component: NotFound, | ||||
|             meta: { requiresAuth: false }, | ||||
|         }, | ||||
|     ], | ||||
|     ] | ||||
| }); | ||||
| 
 | ||||
| router.beforeEach(async (to, _from, next) => { | ||||
|     // Verify if user is logged in before accessing certain routes
 | ||||
|     if (to.meta.requiresAuth) { | ||||
|         if (!authState.isLoggedIn.value) { | ||||
|             //Next("/login");
 | ||||
|             next(); | ||||
|             next("/login"); | ||||
|         } else { | ||||
|             next(); | ||||
|         } | ||||
|  |  | |||
		Reference in a new issue
	
	 Gerald Schmittinger
						Gerald Schmittinger