Files
HellreigN/frontend/src/app/providers/routing/helper/protected.route.tsx
T
nikitaa_ts add00401de
ci-front / build (push) Successful in 2m21s
feat: create stucture
2026-04-03 19:56:41 +03:00

13 lines
334 B
TypeScript

import { useAuthStore } from "@/store/auth/auth.store";
import { Navigate } from "react-router-dom";
export const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
const { isAuthenticated } = useAuthStore();
if (!isAuthenticated) {
return <Navigate to="/auth" replace />;
}
return <>{children}</>;
};