Migrate frontend to Nuxt 4 and Nuxt UI
- 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
This commit is contained in:
1 parent
d0425c8cb2
commit
a9bef7b50d
22 files changed
+4732
-3472
No files matched your search
@@ -1,9 +1,15 @@
|
||||
const anonymousRoutes = ['/login', '/health'];
|
||||
const anonymousRoutes = ['/login', '/health']
|
||||
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
// If the route is not the login page and the user is not logged in then redirect to login
|
||||
const authenticated = useCookie<boolean>('authenticated');
|
||||
if (!anonymousRoutes.includes(to.path) && !(authenticated.value) ) {
|
||||
return navigateTo('/login');
|
||||
}
|
||||
})
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
const authenticated = useCookie<boolean>('authenticated')
|
||||
|
||||
// Not logged in: send to the login page
|
||||
if (!anonymousRoutes.includes(to.path) && !authenticated.value) {
|
||||
return navigateTo('/login')
|
||||
}
|
||||
|
||||
// Already logged in: skip the login page
|
||||
if (to.path === '/login' && authenticated.value) {
|
||||
return navigateTo('/')
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user