- Upgrade to Nuxt 4 (sources under app/), add @nuxt/ui, Tailwind v4 and Lucide icons; drop @nuxtjs/tailwindcss - Replace the custom Yale* components, Modal, Navbar and icon components with UButton/UInput/UModal/UTable/UCard/UHeader/UBadge/UAlert and toasts - Add dark/light mode toggle and a logout button - Add a useApi composable: central base URL/credentials, JSON-encoded bodies, error handling, and redirect to login when the session expires - Fix modal listener leak, missing People heading, unhandled fetch errors and login redirect for already-authenticated users - Make the code and people tables fit on phone screens - Retake README screenshots
35 lines
854 B
Vue
35 lines
854 B
Vue
<script setup lang="ts">
|
|
const api = useApi()
|
|
const authenticated = useCookie<boolean>('authenticated')
|
|
|
|
const items = [
|
|
{ label: 'Home', to: '/', icon: 'i-lucide-house' },
|
|
{ label: 'People', to: '/people', icon: 'i-lucide-users' }
|
|
]
|
|
|
|
const logout = async () => {
|
|
await api.post('/api/Authentication/logout')
|
|
authenticated.value = false
|
|
await navigateTo('/login')
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<UHeader title="Yale | User Access">
|
|
<UNavigationMenu :items="items" />
|
|
|
|
<template #right>
|
|
<UColorModeButton />
|
|
<UButton color="neutral" variant="ghost" icon="i-lucide-log-out" aria-label="Log out" @click="logout" />
|
|
</template>
|
|
|
|
<template #body>
|
|
<UNavigationMenu :items="items" orientation="vertical" class="-mx-2.5" />
|
|
</template>
|
|
</UHeader>
|
|
|
|
<UContainer class="py-6">
|
|
<slot />
|
|
</UContainer>
|
|
</template>
|