init commit

This commit is contained in:
zihluwang committed 2025-03-26 19:06:46 +08:00
commit a46d254148
22 files changed
+3248

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import { Navigate, Outlet, useLocation } from "react-router"
import { useAppSelector } from "@/store"
export const ProtectedRoute = () => {
const isAuthenticated = useAppSelector((state) => state.auth.isAuthenticated)
const location = useLocation()
if (isAuthenticated) {
return <Navigate to="" state={{ from: location }} replace />
}
return <Outlet />
}