mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-19 07:55:25 +02:00
fix: Only show admin Page when user is admin; Remove Overview section
This commit is contained in:
parent
f0ecace475
commit
b405a0817f
@ -11,15 +11,17 @@ import NavigationButton, {
|
||||
NavigationSection,
|
||||
} from "~/route-widgets/AuthenticateRoute/NavigationButton"
|
||||
|
||||
const sections = (Object.keys(NavigationSection) as Array<keyof typeof NavigationSection>).filter(
|
||||
value => isNaN(Number(value)),
|
||||
)
|
||||
|
||||
export default function AuthenticatedRoute(): ReactElement {
|
||||
const {t} = useTranslation()
|
||||
const theme = useTheme()
|
||||
const user = useUser()
|
||||
|
||||
useUser()
|
||||
const sections = [
|
||||
NavigationSection.Aliases,
|
||||
NavigationSection.Reports,
|
||||
NavigationSection.Settings,
|
||||
user.isAdmin && NavigationSection.Admin,
|
||||
].filter(value => value !== false) as NavigationSection[]
|
||||
|
||||
return (
|
||||
<LockNavigationContextProvider>
|
||||
@ -50,7 +52,7 @@ export default function AuthenticatedRoute(): ReactElement {
|
||||
<List component="nav">
|
||||
{sections.map(key => (
|
||||
<ListItem key={key}>
|
||||
<NavigationButton section={NavigationSection[key]} />
|
||||
<NavigationButton section={key} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
|
@ -45,7 +45,6 @@ export default function VerifyEmailRoute(): ReactElement {
|
||||
verifyEmail,
|
||||
{
|
||||
onSuccess: ({user}) => {
|
||||
setEmail("")
|
||||
login(user)
|
||||
navigate("/auth/complete-account")
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user