配置Vite代理、API请求封装、JWT认证上下文、登录页面、路由鉴权

This commit is contained in:
yml2213
2026-07-14 11:30:33 +08:00
parent a0ced7bdde
commit 6d437b4e82
8 changed files with 264 additions and 17 deletions
+10
View File
@@ -0,0 +1,10 @@
import { Navigate, Outlet } from 'react-router-dom'
import { useAuth } from '@/stores/auth'
const RequireAuth = () => {
const { user } = useAuth()
if (!user) return <Navigate to="/login" replace />
return <Outlet />
}
export default RequireAuth