Buttons hidden by permissions

This commit is contained in:
2025-03-15 16:51:13 -04:00
parent 56236fd2ac
commit a842c24d0d
44 changed files with 624 additions and 94 deletions

View File

@@ -1,29 +1,10 @@
import { useAuth } from "@/providers/AuthProvider";
import { isSiteAdmin } from "@/util/PermissionUtil";
import { NavLink } from "react-router";
const protectedLinks = [
{
name: "Games",
path: "/game"
},
{
name: "Groups",
path: "/raidGroup"
},
{
name: "Admin",
path: "/admin"
},
{
name: "Logout",
path: "/logout"
}
];
export default function ProtectedNavLinks(){
const { jwt } = useAuth();
const { jwt, accountPermissions } = useAuth();
if(!jwt){
@@ -31,6 +12,30 @@ export default function ProtectedNavLinks(){
}
const protectedLinks = [
{
name: "Game",
path: "/game"
},
{
name: "Raid Group",
path: "/raidGroup"
}
];
if(isSiteAdmin(accountPermissions)){
protectedLinks.push({
name: "Admin",
path: "/admin"
});
}
protectedLinks.push({
name: "Logout",
path: "/logout"
});
console.log("is admin = " + isSiteAdmin(accountPermissions));
return (
<>
{