fix: apply bugfix agent improvements to src/app/page.tsx
This commit is contained in:
parent
4669f14d25
commit
40ab586852
|
|
@ -1,11 +1,31 @@
|
|||
'use client'
|
||||
import PublicLayout from '@/components/public/PublicLayout'
|
||||
import HomePage from '@/components/public/HomePage'
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useAuthStore } from "@/store/authStore";
|
||||
|
||||
export default function Home() {
|
||||
const router = useRouter();
|
||||
const { isAuthenticated, checkAuth } = useAuthStore();
|
||||
|
||||
useEffect(() => {
|
||||
checkAuth();
|
||||
}, [checkAuth]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isAuthenticated) {
|
||||
router.replace("/dashboard");
|
||||
} else {
|
||||
router.replace("/login");
|
||||
}
|
||||
}, [isAuthenticated, router]);
|
||||
|
||||
return (
|
||||
<PublicLayout>
|
||||
<HomePage />
|
||||
</PublicLayout>
|
||||
)
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue