Files
rustfs-console/middleware/auth.global.ts
T
overtrueandClaude de0f2c550d feat: improve TypeScript type safety and code quality
- Added comprehensive TypeScript type definitions for app configuration
- Fixed type safety issues in sidebar component with proper type casting
- Improved code organization with better file naming conventions
- Enhanced error handling with centralized error management
- Added performance optimizations with caching and code splitting
- Improved development experience with better tooling configuration
- Updated project documentation with comprehensive README
- Added proper type definitions for navigation items and app config
- Fixed licensing information and added proper Apache 2.0 license

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-10 23:19:22 +08:00

19 lines
401 B
TypeScript

export default defineNuxtRouteMiddleware((to, from) => {
const isAuthenticated = useAuth().isAuthenticated.value
// 允许访问登录页面和配置页面
if (to.path === '/auth/login' || to.path === '/config') {
if (isAuthenticated && to.path === '/auth/login') {
return navigateTo('/')
}
return
}
if (!isAuthenticated) {
return navigateTo('/auth/login')
}
})