fix: apply bugfix agent improvements to src/app/page.tsx

This commit is contained in:
cupadev-admin 2026-03-09 12:48:28 +00:00
parent 4669f14d25
commit 40ab586852
1 changed files with 27 additions and 7 deletions

View File

@ -1,11 +1,31 @@
'use client' "use client";
import PublicLayout from '@/components/public/PublicLayout'
import HomePage from '@/components/public/HomePage' import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { useAuthStore } from "@/store/authStore";
export default function Home() { export default function Home() {
return ( const router = useRouter();
<PublicLayout> const { isAuthenticated, checkAuth } = useAuthStore();
<HomePage />
</PublicLayout> useEffect(() => {
) checkAuth();
}, [checkAuth]);
useEffect(() => {
if (isAuthenticated) {
router.replace("/dashboard");
} else {
router.replace("/login");
}
}, [isAuthenticated, router]);
return (
<div className="min-h-screen flex items-center justify-center bg-gray-50">
<div className="flex flex-col items-center gap-3">
<div className="w-10 h-10 border-4 border-primary-500 border-t-transparent rounded-full animate-spin" />
<p className="text-gray-500 text-sm">Loading...</p>
</div>
</div>
);
} }