Skip to content

Commit

Permalink
added allocation error handling (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamoskvin authored Jul 26, 2024
1 parent 9524dd9 commit 8936935
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/pages/Rewards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,16 @@ const ConnectedToSepolia = () => {
)
}

const AllocationError = () => {
return (
<ConnectWalletWrapper>
<ConnectWalletText>
An error occurred while checking your allocation. Don't worry; it is OK. Please try again later.
</ConnectWalletText>
</ConnectWalletWrapper>
)
}

function getRewardsData(jediRewards: any, pool: any) {
if (!jediRewards) {
return
Expand Down Expand Up @@ -598,6 +608,7 @@ export default function Rewards() {

const [allocations, setAllocations] = useState<CurrencyAmount>()
const [allocationsLoading, setAllocationsLoading] = useState(false)
const [allocationsLoadingError, setAllocationsLoadingError] = useState(false)
const [claimData, setClaimData] = useState({})
const [allocated, setAllocated] = useState(false)
const [callData, setCallData] = useState<Call[]>([])
Expand Down Expand Up @@ -636,9 +647,11 @@ export default function Rewards() {
setAllocated(isAllocatedMoreThanZero)
setClaimData(call_data)
setAllocationsLoading(false)
setAllocationsLoadingError(false)
} catch (e) {
setAllocationsLoading(false)
console.error(e)
setAllocationsLoadingError(true)
console.error('allocation_loading_error', e)
}
}
}
Expand Down Expand Up @@ -835,6 +848,8 @@ export default function Rewards() {
<WalletNotConnected />
) : isSepoliaSelected ? (
<ConnectedToSepolia />
) : allocationsLoadingError ? (
<AllocationError />
) : (
<>
<AutoColumn>
Expand Down

0 comments on commit 8936935

Please sign in to comment.