diff --git a/app/(main)/lottery/page.tsx b/app/(main)/lottery/page.tsx index b201b86..1c813c8 100644 --- a/app/(main)/lottery/page.tsx +++ b/app/(main)/lottery/page.tsx @@ -34,6 +34,8 @@ const LotteryPage = () => { if (response.errorMessage) { // If authentication fails, redirect to the auth page + console.log("redirecting form lottery/"); + router.replace("/lottery/auth"); } else { // ✅ Set the authenticated state @@ -53,7 +55,7 @@ const LotteryPage = () => { checkAuth(); }, [router, setAuth]); - if (isLoading) { + if (isLoading && !lotteryData?.data) {
; @@ -61,48 +63,50 @@ const LotteryPage = () => { return ( -
- {lotteryData && ( -
- + {lotteryData?.data && ( +
+ {lotteryData && ( +
+ - {status === "not-started" ? ( -
- -
- ) : null} -
- )} - - - -
- {lotteryData && (status === "ended" || status === "started") && ( - + {status === "not-started" ? ( +
+ +
+ ) : null} +
)} -
-
- - Çykmak - + + + +
+ {lotteryData && (status === "ended" || status === "started") && ( + + )} +
+
+ + Çykmak + +
-
+ )} ); }; diff --git a/components/lottery/auth/ProtectedRoute.tsx b/components/lottery/auth/ProtectedRoute.tsx index 280def1..8f39ada 100644 --- a/components/lottery/auth/ProtectedRoute.tsx +++ b/components/lottery/auth/ProtectedRoute.tsx @@ -23,6 +23,7 @@ const ProtectedRoute = ({ children }: { children: React.ReactNode }) => { if (response.errorMessage) { // If authentication fails, redirect to the auth page + console.log("redirecting form protected route"); router.replace("/lottery/auth"); } else { // ✅ Set the authenticated state