mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 10:13:32 -04:00 
			
		
		
		
	add avanced-only
This commit is contained in:
		
							
								
								
									
										11
									
								
								frontend/middleware/advanced-only.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/middleware/advanced-only.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | interface AdvancedOnlyRedirectParams { | ||||||
|  |     $auth: any | ||||||
|  |     redirect: (path: string) => void | ||||||
|  | } | ||||||
|  | export default function ({ $auth, redirect }: AdvancedOnlyRedirectParams) { | ||||||
|  |     // If the user is not allowed to organize redirect to the home page | ||||||
|  |     if (!$auth.user.advanced) { | ||||||
|  |         console.warn("User is not allowed to access advanced features"); | ||||||
|  |         return redirect("/") | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -3,7 +3,6 @@ interface CanOrganizeRedirectParams { | |||||||
|     redirect: (path: string) => void |     redirect: (path: string) => void | ||||||
| } | } | ||||||
| export default function ({ $auth, redirect }: CanOrganizeRedirectParams) { | export default function ({ $auth, redirect }: CanOrganizeRedirectParams) { | ||||||
|     console.log($auth.user); |  | ||||||
|     // If the user is not allowed to organize redirect to the home page |     // If the user is not allowed to organize redirect to the home page | ||||||
|     if (!$auth.user.canOrganize) { |     if (!$auth.user.canOrganize) { | ||||||
|         console.warn("User is not allowed to organize data"); |         console.warn("User is not allowed to organize data"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user