Files
dticket.tootaio.com/app/middleware/guest.ts
xiaomai 07e5d42005 refactor: centralize validation, error handling, and formatting logic
Extract shared auth logic and validation rules to shared/auth.ts
Introduce utility functions for HTTP errors and user input parsing
Standardize error messages and date formatting across the app
2026-04-12 20:29:39 +08:00

13 lines
282 B
TypeScript

import { getDefaultAuthenticatedPath } from '~~/shared/auth'
export default defineNuxtRouteMiddleware(async () => {
const auth = useAuth()
await auth.fetchSession()
if (!auth.user.value) {
return
}
return navigateTo(getDefaultAuthenticatedPath(auth.user.value))
})