diff --git a/app/components/claimXTicket.tsx b/app/components/claimXTicket.tsx index 344d427..7135dc9 100644 --- a/app/components/claimXTicket.tsx +++ b/app/components/claimXTicket.tsx @@ -16,8 +16,6 @@ type ClaimXTicketProps = { showClaimed?: boolean; width?: number; setHasClaimedX: (hasClaimedX: boolean) => void; - // setErrorMsg: (msg: string) => void; - // setShowErrorMsg: (show: boolean) => void; }; const ClaimXTicket: FunctionComponent = ({ @@ -28,8 +26,6 @@ const ClaimXTicket: FunctionComponent = ({ showClaimed = true, width = 200, setHasClaimedX, - // setErrorMsg, - // setShowErrorMsg, }) => { const searchParams = useSearchParams(); const claimXStatus = searchParams.get("success"); diff --git a/app/page.tsx b/app/page.tsx index ca276fb..66a741f 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -118,12 +118,7 @@ export default function Home() { const [isLaunched, setIsLaunched] = useState(false); // Claim X ticket - // const searchParams = useSearchParams(); - // const claimXStatus = searchParams.get("success"); - // const claimXError = searchParams.get("error_msg"); - const [hasClaimedX, setHasClaimedX] = useState( - getHasClaimedXTicket() - ); + const [hasClaimedX, setHasClaimedX] = useState(); // Claim 2FA ticket const walletType = getWalletType(network, address); @@ -145,6 +140,12 @@ export default function Home() { setIsLaunched(Number(process.env.NEXT_PUBLIC_LAUNCH_TIME) < Date.now()); }, []); + useEffect(() => { + if (typeof window !== "undefined") { + setHasClaimedX(getHasClaimedXTicket()); + } + }, []); + useEffect(() => { if (network === NetworkType.STARKNET && starknetAccount) { starknetIdNavigator @@ -224,23 +225,6 @@ export default function Home() { }; }, []); - // useEffect(() => { - // if (!claimXStatus) return; - // if (claimXStatus === "true") { - // if (!hasClaimedX) { - // storeHasClaimedXTicket(); - // setHasClaimedX(true); - // } - // } else if (claimXStatus === "false" && claimXError) { - // // show error message - // if ((claimXError as string).includes("already claimed")) { - // setHasClaimedX(true); - // } - // setErrorMsg(claimXError); - // setShowErrorMsg(true); - // } - // }, [claimXStatus, claimXError]); - useEffect(() => { if (network === NetworkType.EVM) { setHasClaimed2FA(undefined);