Skip to content

Commit

Permalink
OCT-1519 Prevent client from calling for threshold outside AW as it t…
Browse files Browse the repository at this point in the history
…hrows 400 (#122)
  • Loading branch information
aziolek authored Apr 3, 2024
1 parent b3275e6 commit 3cfe34a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/src/hooks/queries/useProjectRewardsThreshold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ export default function useProjectRewardsThreshold(

return useQuery({
enabled:
isDecisionWindowOpen !== undefined &&
((epoch !== undefined && epoch > 0) || (!!currentEpoch && currentEpoch > 1)),
!!currentEpoch &&
currentEpoch > 1 &&
(isDecisionWindowOpen === true || (epoch !== undefined && epoch > 0)),
queryFn: () =>
apiGetProjectThreshold(epoch ?? (isDecisionWindowOpen ? currentEpoch! - 1 : currentEpoch!)),
queryKey: QUERY_KEYS.projectRewardsThreshold(
Expand Down

0 comments on commit 3cfe34a

Please sign in to comment.