Full project added

This commit is contained in:
Marcelo Dares
2025-12-17 20:24:06 +00:00
parent fc2e4fd15a
commit 0e9b2dd72d
36 changed files with 2050 additions and 84 deletions

View File

@@ -0,0 +1,29 @@
"use client";
import { usePathname, useRouter } from "next/navigation";
import { useEffect, useState } from "react";
export function RequireAuth({ children }: { children: React.ReactNode }) {
const router = useRouter();
const pathname = usePathname();
const [ready, setReady] = useState(false);
useEffect(() => {
const token = localStorage.getItem("ct_token");
if (!token) {
router.replace("/login");
return;
}
setReady(true);
}, [router, pathname]);
if (!ready) {
return (
<div className="min-h-screen bg-[#070A0C] text-zinc-200 flex items-center justify-center">
Loading
</div>
);
}
return <>{children}</>;
}