first commit

This commit is contained in:
Billy Marcello
2025-10-19 00:12:48 +07:00
commit fcdbf7d664
76 changed files with 9742 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import { Outlet, useNavigate } from "react-router-dom";
import { useEffect } from "react";
const PrivateRoute = () => {
const navigate = useNavigate();
const token = document.cookie
.split("; ")
.find((row) => row.startsWith("token="))
?.split("=")[1];
useEffect(() => {
if (!token) {
navigate("/humic-20242025-2");
}
}, [navigate, token]);
return token ? <Outlet /> : null;
};
export default PrivateRoute;