mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-02 02:03:20 -05:00
add group-only middleware
This commit is contained in:
11
frontend/middleware/group-only.ts
Normal file
11
frontend/middleware/group-only.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
interface GroupOnlyRedirectParams {
|
||||
$auth: any
|
||||
route: any
|
||||
redirect: (path: string) => void
|
||||
}
|
||||
|
||||
export default function ({ $auth, route, redirect }: GroupOnlyRedirectParams) {
|
||||
if (route.params.groupSlug !== $auth.user.groupSlug) {
|
||||
redirect("/")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user