Skip to content

Commit

Permalink
Fix pool reward query error response
Browse files Browse the repository at this point in the history
  • Loading branch information
jonator committed Nov 23, 2022
1 parent 11027f1 commit 4f25217
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/stores/src/queries-external/pool-rewards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ export class ObservableQueryAccountPoolRewards extends ObservableQueryExternalBa

if (!this.response || !fiat) return undefined;

const poolIds =
this.response.data.pools !== undefined &&
this.response.data.pools !== null &&
typeof this.response.data.pools === "object"
? Object.keys(this.response.data.pools)
: [];

if (!poolIds.includes(poolId)) return undefined;

const poolRewards = this.response.data.pools[poolId] as
| PoolsRewards["pools"][0]
| undefined;
Expand Down

3 comments on commit 4f25217

@vercel
Copy link

@vercel vercel bot commented on 4f25217 Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 4f25217 Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 4f25217 Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.