testing again
This commit is contained in:
parent
bd79394c89
commit
5f15114f96
|
|
@ -34,6 +34,8 @@ const LotteryPage = () => {
|
||||||
|
|
||||||
if (response.errorMessage) {
|
if (response.errorMessage) {
|
||||||
// If authentication fails, redirect to the auth page
|
// If authentication fails, redirect to the auth page
|
||||||
|
console.log("redirecting form lottery/");
|
||||||
|
|
||||||
router.replace("/lottery/auth");
|
router.replace("/lottery/auth");
|
||||||
} else {
|
} else {
|
||||||
// ✅ Set the authenticated state
|
// ✅ Set the authenticated state
|
||||||
|
|
@ -53,7 +55,7 @@ const LotteryPage = () => {
|
||||||
checkAuth();
|
checkAuth();
|
||||||
}, [router, setAuth]);
|
}, [router, setAuth]);
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading && !lotteryData?.data) {
|
||||||
<div className="flex w-full h-[90vh] justify-center items-center">
|
<div className="flex w-full h-[90vh] justify-center items-center">
|
||||||
<Loader />
|
<Loader />
|
||||||
</div>;
|
</div>;
|
||||||
|
|
@ -61,6 +63,7 @@ const LotteryPage = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ProtectedRoute>
|
<ProtectedRoute>
|
||||||
|
{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">
|
<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 && (
|
{lotteryData && (
|
||||||
<div className="flex flex-col sm:gap-[64px] gap-[40px]">
|
<div className="flex flex-col sm:gap-[64px] gap-[40px]">
|
||||||
|
|
@ -103,6 +106,7 @@ const LotteryPage = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</ProtectedRoute>
|
</ProtectedRoute>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
|
||||||
|
|
||||||
if (response.errorMessage) {
|
if (response.errorMessage) {
|
||||||
// If authentication fails, redirect to the auth page
|
// If authentication fails, redirect to the auth page
|
||||||
|
console.log("redirecting form protected route");
|
||||||
router.replace("/lottery/auth");
|
router.replace("/lottery/auth");
|
||||||
} else {
|
} else {
|
||||||
// ✅ Set the authenticated state
|
// ✅ Set the authenticated state
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue