From ed0e12b1b68adf92d4a3e2dd4b5fec744e5e6d0e Mon Sep 17 00:00:00 2001 From: ReLoia Date: Wed, 17 Jun 2026 22:27:03 +0200 Subject: [PATCH] feat: add role negation and negate some routes to admins --- app/components/Header.vue | 8 ++++---- app/middleware/auth.ts | 8 +++++--- app/pages/reports/new.vue | 3 +++ app/utils/roles.ts | 35 +++++++++++++++++++++++++++++++++-- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/app/components/Header.vue b/app/components/Header.vue index ba024a2..3b07a04 100644 --- a/app/components/Header.vue +++ b/app/components/Header.vue @@ -26,15 +26,15 @@ onUnmounted(() => { } }) +const { isAuthenticated, user, logout } = useAuth() +const panelLabel = computed(() => isAdmin(user.value?.role) ? 'Pannello' : 'Dashboard') + const navLinks = [ { name: 'Home', path: '/' }, - { name: 'Fai una segnalazione', path: '/reports/new' }, + ...(isCitizen(user.value?.role) ? [{ name: 'Fai una segnalazione', path: '/reports/new' }] : []), { name: 'Esplora i dati', path: '/open-data' }, { name: 'Come funziona', path: '/info' } ] - -const { isAuthenticated, user, logout } = useAuth() -const panelLabel = computed(() => isAdmin(user.value?.role) ? 'Pannello' : 'Dashboard')