fix admin pages accessible by non admin users (#2988)

Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
Kuchenpirat
2024-01-14 17:03:31 +01:00
committed by GitHub
parent 43958527f4
commit 030588e5bb
2 changed files with 11 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
interface AuthRedirectParams {
$auth: any
redirect: (path: string) => void
}
export default function ({ $auth, redirect }: AuthRedirectParams) {
// If the user is not an admin redirect to the home page
if (!$auth.user.admin) {
return redirect("/")
}
}