-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/optimize api calls hydra datum button (#524)
- Loading branch information
1 parent
9ea3d1d
commit 2602abb
Showing
8 changed files
with
625 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
import { ByEventStats, ByProposalsInCategoryStats } from 'types/voting-app-types'; | ||
import { DEFAULT_CONTENT_TYPE_HEADERS, doRequest, HttpMethods } from '../handlers/httpHandler'; | ||
import { env } from '../constants/env'; | ||
import { TallyResults } from 'types/voting-ledger-follower-types'; | ||
|
||
const LEADERBOARD_URL = `${env.VOTING_APP_SERVER_URL}/api/leaderboard`; | ||
const HYDRATALLY_URL = `${env.VOTING_LEDGER_FOLLOWER_APP_SERVER_URL}/api/tally/voting-results`; | ||
|
||
const getStats = async () => | ||
await doRequest<ByEventStats>(HttpMethods.GET, `${LEADERBOARD_URL}/${env.EVENT_ID}`, { | ||
...DEFAULT_CONTENT_TYPE_HEADERS, | ||
}); | ||
|
||
const getCategoryLevelStats = async (categoryId) => | ||
await doRequest<ByProposalsInCategoryStats>(HttpMethods.GET, `${LEADERBOARD_URL}/${env.EVENT_ID}/${categoryId}`, { | ||
const getVotingResults = async () => | ||
await doRequest<ByProposalsInCategoryStats>(HttpMethods.GET, `${LEADERBOARD_URL}/${env.EVENT_ID}/results?source=db`, { | ||
...DEFAULT_CONTENT_TYPE_HEADERS, | ||
}); | ||
|
||
const getHydraTallyStats = async (categoryId) => | ||
await doRequest<ByProposalsInCategoryStats>(HttpMethods.GET, `${LEADERBOARD_URL}/${env.EVENT_ID}/${categoryId}?source=l1`, { | ||
const getHydraTallyStats = async () => | ||
await doRequest<TallyResults>(HttpMethods.GET, `${HYDRATALLY_URL}/${env.EVENT_ID}/Hydra_Tally_Experiment`, { | ||
...DEFAULT_CONTENT_TYPE_HEADERS, | ||
}); | ||
|
||
export { getStats, getCategoryLevelStats, getHydraTallyStats }; | ||
export { getStats, getVotingResults, getHydraTallyStats }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.