"use client"; import { useEffect, useState } from "react"; import { useLotteryAuth } from "@/store/useLotteryAuth"; import ProtectedRoute from "@/components/lottery/auth/ProtectedRoute"; import LotteryHeader from "@/components/lottery/LotteryHeader"; import LotteryWinnersSection from "@/components/lottery/LotteryWinnersSection"; import LotteryRulesSection from "@/components/lottery/rules/LotteryRulesSection"; import LotteryCountDown from "@/components/lottery/countDown/LotteryCountDown"; import { Queries } from "@/api/queries"; import Link from "next/link"; import { useRouter } from "next/navigation"; import Loader from "@/components/Loader"; import { authenticateLottery } from "@/api"; import { ILotteryResponse } from "@/models/lottery/lottery.model"; const LotteryPage = () => { const [lotteryData, setData] = useState(); const [status, setStatus] = useState<"not-started" | "started" | "ended">( "not-started" ); const [isLoading, setIsLoading] = useState(true); const router = useRouter(); useEffect(() => { const checkAuth = async () => { const res = await authenticateLottery(); setData(res); }; checkAuth(); }, []); if (isLoading && !lotteryData?.data) {
; } return ( {lotteryData?.data && (
{lotteryData && (
{status === "not-started" ? (
) : null}
)}
{lotteryData && (status === "ended" || status === "started") && ( )}
Çykmak
)}
); }; export default LotteryPage;