first commit

This commit is contained in:
Space
2026-01-17 13:37:57 +01:00
commit 3e34d84a29
49 changed files with 8579 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { useEffect, type ReactNode } from "react";
import { useNavigate } from "react-router";
import { api } from "~/api/client";
interface ProtectedRouteProps {
children: ReactNode;
}
export function ProtectedRoute({ children }: ProtectedRouteProps) {
const navigate = useNavigate();
useEffect(() => {
if (!api.isAuthenticated()) {
navigate("/login");
}
}, [navigate]);
if (!api.isAuthenticated()) {
return null;
}
return <>{children}</>;
}