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[]
|
roles: Role[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type Role = 'User' | 'SuperUser'
|
export enum Role {
|
||||||
|
User = 0,
|
||||||
|
SuperUser = 1,
|
||||||
|
}
|
||||||
|
|
||||||
let globalUser: User | null
|
let globalUser: User | null
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { PropsWithChildren } from 'react'
|
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'
|
import NavButton from './buttons/NavButton.tsx'
|
||||||
|
|
||||||
type NavBarProps = unknown
|
type NavBarProps = unknown
|
||||||
|
|
||||||
export default function NavBar({ children }: PropsWithChildren<NavBarProps>) {
|
export default function NavBar({ children }: PropsWithChildren<NavBarProps>) {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const isSuperUser = user?.roles.includes('SuperUser')
|
const isSuperUser = user?.roles.includes(Role.SuperUser)
|
||||||
return (
|
return (
|
||||||
<nav className={`w-full flex flex-row justify-end gap-4 px-4 md:px-8 py-3`}>
|
<nav className={`w-full flex flex-row justify-end gap-4 px-4 md:px-8 py-3`}>
|
||||||
{children}
|
{children}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue