diff --git a/app/(private)/wish/page.tsx b/app/(private)/wish/page.tsx index be234a0..3c904ed 100644 --- a/app/(private)/wish/page.tsx +++ b/app/(private)/wish/page.tsx @@ -103,13 +103,15 @@ export default function Page() { }, [jackpotData?.jackpots]) const addGemHandler = (type: string) => { - for (let i = 0; i < jackpotData?.jackpots?.[0]?.slot; i++) { - if (selectedGems[i] == undefined) { - selectedGems[i] = type - break + if (jackpotData?.jackpots && !jackpotData?.jackpots?.[0]?.winning_numbers) { + for (let i = 0; i < jackpotData?.jackpots?.[0]?.slot; i++) { + if (selectedGems[i] == undefined) { + selectedGems[i] = type + break + } } + setSelectedGems([...selectedGems]) } - setSelectedGems([...selectedGems]) } const wishHandler = async () => { @@ -142,7 +144,7 @@ export default function Page() { })), 'auto' ) - const res = await wish(jackpotData.jackpots[0].id , tokens) + const res = await wish(jackpotData.jackpots[0].id, tokens) if (res.data) { setTimeout(() => { setSubmittedGems(selectedGems) diff --git a/provider/index.tsx b/provider/index.tsx index bc2d61a..2abd9ba 100644 --- a/provider/index.tsx +++ b/provider/index.tsx @@ -406,7 +406,7 @@ function ContextProvider({ children }: { children: ReactNode }) { {children} - +