diff --git a/src/pages/dashboard/dashboard_layout.tsx b/src/pages/dashboard/dashboard_layout.tsx index 20510a7..20e3aab 100644 --- a/src/pages/dashboard/dashboard_layout.tsx +++ b/src/pages/dashboard/dashboard_layout.tsx @@ -31,6 +31,7 @@ import { default as clientRoutes, } from "@/clientRoutes"; import apiFetch from "@/lib/apiFetch"; +import ProtectedRoute from "@/components/ProtectedRoute"; /* ----------------------- Logout ----------------------- */ function Logout() { @@ -59,23 +60,6 @@ export default function DashboardLayout() { defaultValue: true, }); - const [isAuthenticated, setIsAuthenticated] = useState(null); - - useEffect(() => { - async function checkSession() { - try { - // backend otomatis baca cookie JWT dari request - const res = await apiFetch.api.user.find.get(); - setIsAuthenticated(res.status === 200); - } catch { - setIsAuthenticated(false); - } - } - checkSession(); - }, []); - - if (isAuthenticated === null) return null; - if (!isAuthenticated) return ; return ( - - +