From 80f9b430225c157cc55cbb6931b569bda2739ff6 Mon Sep 17 00:00:00 2001 From: john Date: Tue, 20 May 2025 23:49:45 +0200 Subject: [PATCH] fix super user check --- src/app/user/user.ts | 4 +++- src/components/NavBar.tsx | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) 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 ( ) }