- Rename helix-server -> server and helix-web -> web - Remove helix-api (bruno collection and docs site) - Merge per-module .gitignore files into the root .gitignore - Add README, AGENTS, CONTRIBUTING and MIT LICENCE - Add full-stack docker-compose (postgres, redis, server, web via Caddy) with web Dockerfile, Caddyfile and Compose server config - Keep the Gradle wrapper jar tracked after the .gitignore merge - Copy gradle.properties into the server Docker build image
23 lines
560 B
TypeScript
23 lines
560 B
TypeScript
import { Navigate, Outlet, useLocation } from "react-router"
|
|
import { useAppSelector } from "@/store"
|
|
import DashboardLayout from "@/layouts/dashboard-layout"
|
|
|
|
/**
|
|
* 需要身份验证的前置组件
|
|
* @constructor
|
|
*/
|
|
export default function ProtectedRoute() {
|
|
const isAuthenticated = useAppSelector((state) => state.auth.isAuthenticated)
|
|
const location = useLocation()
|
|
|
|
if (!isAuthenticated) {
|
|
return <Navigate to="/login" state={{ from: location }} replace />
|
|
}
|
|
|
|
return (
|
|
<DashboardLayout >
|
|
<Outlet />
|
|
</DashboardLayout>
|
|
)
|
|
}
|