mealie/frontend/middleware/advanced-only.ts
2024-02-07 11:28:26 +00:00

12 lines
399 B
TypeScript

interface AdvancedOnlyRedirectParams {
$auth: any
redirect: (path: string) => void
}
export default function ({ $auth, redirect }: AdvancedOnlyRedirectParams) {
// If the user is not allowed to access advanced features redirect to the home page
if (!$auth.user.advanced) {
console.warn("User is not allowed to access advanced features");
return redirect("/")
}
}