Skip to content

Commit

Permalink
Merge pull request #443 from DeXter-on-Radix/reduce-rewards-page-erro…
Browse files Browse the repository at this point in the history
…r-toasts

Reduce rewards page error toasts
dcts authored Jun 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 92de6f9 + dec6cc5 commit 59cb7a8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/app/rewards/page.tsx
Original file line number Diff line number Diff line change
@@ -101,13 +101,23 @@ function RewardsCard() {
const userHasRewards = getUserHasRewards(rewardData);

useEffect(() => {
// Performs 4 sequential actions:
// 1. fetchAddresses : fetches relevant rewards component addresses
// 2. fetchAccountRewards: fetches rewards for a specific account
// 3. fetchReciepts : fetches NFT reciepts
// 4. fetchOrderRewards : fetches rewards based on the NFT reciepts
async function loadRewards() {
await dispatch(fetchAddresses());
let fetchReceiptsAction = await dispatch(fetchReciepts(pairsList));
// console.log("fetchReceiptsAction: ", fetchReceiptsAction);
const fetchAddressesResult = await dispatch(fetchAddresses());
if (!fetchAddressesResult.payload) {
return; // stop loading rewards if addresses could not be loaded
}
await dispatch(fetchAccountRewards());
let fetchReceiptsResult = await dispatch(fetchReciepts(pairsList));
if (!fetchReceiptsResult.payload) {
return; // stop loading order rewards if reciepts are not loaded successfully
}
await dispatch(
fetchOrderRewards(fetchReceiptsAction.payload as string[])
fetchOrderRewards(fetchReceiptsResult.payload as string[])
);
}
if (isConnected) {

0 comments on commit 59cb7a8

Please sign in to comment.