mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-01-24 17:52:56 -05:00
manage-data pages
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
interface AuthRedirectParams {
|
||||
interface AdminRedirectParams {
|
||||
$auth: any
|
||||
redirect: (path: string) => void
|
||||
}
|
||||
export default function ({ $auth, redirect }: AuthRedirectParams) {
|
||||
export default function ({ $auth, redirect }: AdminRedirectParams) {
|
||||
// If the user is not an admin redirect to the home page
|
||||
if (!$auth.user.admin) {
|
||||
return redirect("/")
|
||||
|
||||
12
frontend/middleware/can-organize-only.ts
Normal file
12
frontend/middleware/can-organize-only.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
interface CanOrganizeRedirectParams {
|
||||
$auth: any
|
||||
redirect: (path: string) => void
|
||||
}
|
||||
export default function ({ $auth, redirect }: CanOrganizeRedirectParams) {
|
||||
console.log($auth.user);
|
||||
// If the user is not allowed to organize redirect to the home page
|
||||
if (!$auth.user.canOrganize) {
|
||||
console.warn("User is not allowed to organize data");
|
||||
return redirect("/")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user