diff --git a/src/app/user/user.ts b/src/app/user/user.ts index 1791670..b8b8a26 100644 --- a/src/app/user/user.ts +++ b/src/app/user/user.ts @@ -7,9 +7,11 @@ import { setGlobal } from '../femtoApp.ts' export interface User { id: string username: string - roles: string[] + roles: Role[] } +type Role = 'User' | 'SuperUser' + let globalUser: User | null export function initUser() { diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index 8127122..b55a24f 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -6,10 +6,11 @@ type NavBarProps = unknown export default function NavBar({ children }: PropsWithChildren) { const user = useUser() + const isSuperUser = user?.roles.includes('SuperUser') return ( ) }