Buttons hidden by permissions
This commit is contained in:
@@ -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 (
|
||||
<>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user