working on flashmessages
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<n-menu v-model:value="activeKey" mode="horizontal" :options="menuOptions" />
|
||||
<n-menu
|
||||
v-model:value="activeKey"
|
||||
mode="horizontal"
|
||||
:options="menuOptions"
|
||||
class="-mx-4"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -12,47 +17,51 @@
|
||||
LogOutFilled as Logout
|
||||
} from '@vicons/material'
|
||||
|
||||
const { request } = usePage().props
|
||||
const { request, isAdmin } = usePage().props
|
||||
const activeKey = ref(request.url)
|
||||
|
||||
const menuOptions = ref([
|
||||
{
|
||||
label: () =>
|
||||
h(
|
||||
Link, {
|
||||
href: "/events",
|
||||
methode: "get"
|
||||
},
|
||||
"Veranstaltungen"
|
||||
),
|
||||
key: '/events',
|
||||
icon: renderIcon(Events)
|
||||
},
|
||||
{
|
||||
label: () =>
|
||||
h(
|
||||
Link, {
|
||||
href: "/users",
|
||||
method: "get"
|
||||
},
|
||||
"Benutzer"
|
||||
),
|
||||
key: '/users',
|
||||
icon: renderIcon(Users)
|
||||
},
|
||||
{
|
||||
label: () =>
|
||||
h(
|
||||
Link, {
|
||||
href: "/login",
|
||||
method: "get"
|
||||
},
|
||||
"Abmelden"
|
||||
),
|
||||
key: '/logout',
|
||||
icon: renderIcon(Logout)
|
||||
}
|
||||
])
|
||||
const menuOptions = ref([])
|
||||
menuOptions.value.push({
|
||||
label: () =>
|
||||
h(
|
||||
Link, {
|
||||
href: "/events",
|
||||
methode: "get"
|
||||
},
|
||||
() => "Veranstaltungen"
|
||||
),
|
||||
key: '/events',
|
||||
icon: renderIcon(Events)
|
||||
})
|
||||
|
||||
if(isAdmin) menuOptions.value.push({
|
||||
label: () =>
|
||||
h(
|
||||
Link, {
|
||||
href: "/users",
|
||||
method: "get"
|
||||
},
|
||||
() => "Benutzer"
|
||||
),
|
||||
key: '/users',
|
||||
icon: renderIcon(Users)
|
||||
})
|
||||
|
||||
menuOptions.value.push({
|
||||
label: () =>
|
||||
h(
|
||||
Link, {
|
||||
href: "/logout",
|
||||
method: "post",
|
||||
as: "button"
|
||||
},
|
||||
() => "Abmelden"
|
||||
),
|
||||
key: '/logout',
|
||||
icon: renderIcon(Logout)
|
||||
})
|
||||
|
||||
|
||||
|
||||
function renderIcon(icon) {
|
||||
return () => h(NIcon, null, { default: () => h(icon) })
|
||||
|
||||
Reference in New Issue
Block a user