fix roles
This commit is contained in:
parent
a070b30def
commit
55fb78ee98
2 changed files with 6 additions and 3 deletions
|
@ -10,7 +10,10 @@ export interface User {
|
|||
roles: Role[]
|
||||
}
|
||||
|
||||
type Role = 'User' | 'SuperUser'
|
||||
export enum Role {
|
||||
User = 0,
|
||||
SuperUser = 1,
|
||||
}
|
||||
|
||||
let globalUser: User | null
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { PropsWithChildren } from 'react'
|
||||
import { useUser } from '../app/user/user.ts'
|
||||
import { Role, useUser } from '../app/user/user.ts'
|
||||
import NavButton from './buttons/NavButton.tsx'
|
||||
|
||||
type NavBarProps = unknown
|
||||
|
||||
export default function NavBar({ children }: PropsWithChildren<NavBarProps>) {
|
||||
const user = useUser()
|
||||
const isSuperUser = user?.roles.includes('SuperUser')
|
||||
const isSuperUser = user?.roles.includes(Role.SuperUser)
|
||||
return (
|
||||
<nav className={`w-full flex flex-row justify-end gap-4 px-4 md:px-8 py-3`}>
|
||||
{children}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue