2024-12-23 19:13:36 +00:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import LotteryAuthForm from "@/components/lottery/auth/LotteryAuthForm";
|
|
|
|
|
import { useEffect } from "react";
|
|
|
|
|
import { useRouter } from "next/navigation";
|
|
|
|
|
import { useLotteryAuth } from "@/store/useLotteryAuth";
|
|
|
|
|
|
|
|
|
|
const LotteryAuthPage = () => {
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const { isAuthenticated, logout } = useLotteryAuth();
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
console.log("Auth page - Authentication state:", isAuthenticated);
|
|
|
|
|
if (isAuthenticated) {
|
|
|
|
|
console.log("Auth page - Redirecting to lottery...");
|
|
|
|
|
router.push("/lottery");
|
|
|
|
|
}
|
|
|
|
|
}, [isAuthenticated, router]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
logout();
|
|
|
|
|
}, [logout]);
|
|
|
|
|
|
|
|
|
|
return (
|
2024-12-29 18:02:23 +00:00
|
|
|
<div className="container">
|
|
|
|
|
<div className="flex justify-center items-center min-h-[50vh] py-[200px]">
|
|
|
|
|
<LotteryAuthForm />
|
|
|
|
|
</div>
|
2024-12-23 19:13:36 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default LotteryAuthPage;
|