testing again
This commit is contained in:
parent
bd79394c89
commit
5f15114f96
|
|
@ -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) {
|
||||
<div className="flex w-full h-[90vh] justify-center items-center">
|
||||
<Loader />
|
||||
</div>;
|
||||
|
|
@ -61,48 +63,50 @@ const LotteryPage = () => {
|
|||
|
||||
return (
|
||||
<ProtectedRoute>
|
||||
<div className="flex flex-col md:gap-[128px] gap-[80px] font-roboto md:pt-[64px] sm:pt-[48px] pt-[40px] ms:pb-[128px] pb-[80px] text-lightOnSurface">
|
||||
{lotteryData && (
|
||||
<div className="flex flex-col sm:gap-[64px] gap-[40px]">
|
||||
<LotteryHeader
|
||||
title={lotteryData.data.title}
|
||||
description={lotteryData.data.description}
|
||||
image={lotteryData.data.image}
|
||||
smsCode={lotteryData.data.sms_code}
|
||||
startDate={lotteryData.data.start_time}
|
||||
/>
|
||||
{lotteryData?.data && (
|
||||
<div className="flex flex-col md:gap-[128px] gap-[80px] font-roboto md:pt-[64px] sm:pt-[48px] pt-[40px] ms:pb-[128px] pb-[80px] text-lightOnSurface">
|
||||
{lotteryData && (
|
||||
<div className="flex flex-col sm:gap-[64px] gap-[40px]">
|
||||
<LotteryHeader
|
||||
title={lotteryData.data.title}
|
||||
description={lotteryData.data.description}
|
||||
image={lotteryData.data.image}
|
||||
smsCode={lotteryData.data.sms_code}
|
||||
startDate={lotteryData.data.start_time}
|
||||
/>
|
||||
|
||||
{status === "not-started" ? (
|
||||
<div className="container">
|
||||
<LotteryCountDown
|
||||
lotteryStatus={status}
|
||||
setLotteryStatus={setStatus}
|
||||
endDate={lotteryData.data.end_time}
|
||||
startDate={lotteryData.data.start_time}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<LotteryRulesSection />
|
||||
|
||||
<div className="flex flex-col gap-10">
|
||||
{lotteryData && (status === "ended" || status === "started") && (
|
||||
<LotteryWinnersSection lotteryStatus={status} />
|
||||
{status === "not-started" ? (
|
||||
<div className="container">
|
||||
<LotteryCountDown
|
||||
lotteryStatus={status}
|
||||
setLotteryStatus={setStatus}
|
||||
endDate={lotteryData.data.end_time}
|
||||
startDate={lotteryData.data.start_time}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
<div className="w-full">
|
||||
<div className="container">
|
||||
<Link
|
||||
href="/lottery/auth"
|
||||
className="sm:text-textLarge sm:leading-textLarge text-[16px] rounded-full leading-[24px] sm:py-[12px] py-[8px] w-full flex justify-center items-center border-2 border-lightPrimary hover:bg-lightPrimary font-medium text-lightPrimary hover:text-lightOnPrimary disabled:opacity-50 transition-all duration-300"
|
||||
>
|
||||
Çykmak
|
||||
</Link>
|
||||
|
||||
<LotteryRulesSection />
|
||||
|
||||
<div className="flex flex-col gap-10">
|
||||
{lotteryData && (status === "ended" || status === "started") && (
|
||||
<LotteryWinnersSection lotteryStatus={status} />
|
||||
)}
|
||||
<div className="w-full">
|
||||
<div className="container">
|
||||
<Link
|
||||
href="/lottery/auth"
|
||||
className="sm:text-textLarge sm:leading-textLarge text-[16px] rounded-full leading-[24px] sm:py-[12px] py-[8px] w-full flex justify-center items-center border-2 border-lightPrimary hover:bg-lightPrimary font-medium text-lightPrimary hover:text-lightOnPrimary disabled:opacity-50 transition-all duration-300"
|
||||
>
|
||||
Çykmak
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</ProtectedRoute>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue