diff options
author | Hsuan Lee <hsuan@cobinhood.com> | 2019-01-19 18:42:04 +0800 |
---|---|---|
committer | Hsuan Lee <hsuan@cobinhood.com> | 2019-01-19 18:42:04 +0800 |
commit | 7ae38906926dc09bc10670c361af0d2bf0050426 (patch) | |
tree | 5fb10ae366b987db09e4ddb4bc3ba0f75404ad08 /packages/website/ts/utils/backend_client.ts | |
parent | b5fd3c72a08aaa6957917d74c333387a16edf66b (diff) | |
download | dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.gz dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.bz2 dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.lz dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.xz dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.zst dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.zip |
Update dependency packages
Diffstat (limited to 'packages/website/ts/utils/backend_client.ts')
-rw-r--r-- | packages/website/ts/utils/backend_client.ts | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/packages/website/ts/utils/backend_client.ts b/packages/website/ts/utils/backend_client.ts deleted file mode 100644 index 5164211df..000000000 --- a/packages/website/ts/utils/backend_client.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as _ from 'lodash'; - -import { - ArticlesBySection, - WebsiteBackendGasInfo, - WebsiteBackendJobInfo, - WebsiteBackendPriceInfo, - WebsiteBackendRelayerInfo, - WebsiteBackendTokenInfo, -} from 'ts/types'; -import { fetchUtils } from 'ts/utils/fetch_utils'; -import { utils } from 'ts/utils/utils'; - -const ETH_GAS_STATION_ENDPOINT = '/eth_gas_station'; -const JOBS_ENDPOINT = '/jobs'; -const PRICES_ENDPOINT = '/prices'; -const RELAYERS_ENDPOINT = '/relayers'; -const TOKENS_ENDPOINT = '/tokens'; -const WIKI_ENDPOINT = '/wiki'; -const SUBSCRIBE_SUBSTACK_NEWSLETTER_ENDPOINT = '/newsletter_subscriber/substack'; - -export const backendClient = { - async getGasInfoAsync(): Promise<WebsiteBackendGasInfo> { - const result = await fetchUtils.requestAsync(utils.getBackendBaseUrl(), ETH_GAS_STATION_ENDPOINT); - return result; - }, - async getJobInfosAsync(): Promise<WebsiteBackendJobInfo[]> { - const result = await fetchUtils.requestAsync(utils.getBackendBaseUrl(), JOBS_ENDPOINT); - return result; - }, - async getPriceInfoAsync(tokenSymbols: string[]): Promise<WebsiteBackendPriceInfo> { - if (_.isEmpty(tokenSymbols)) { - return {}; - } - const joinedTokenSymbols = tokenSymbols.join(','); - const queryParams = { - tokens: joinedTokenSymbols, - }; - const result = await fetchUtils.requestAsync(utils.getBackendBaseUrl(), PRICES_ENDPOINT, queryParams); - return result; - }, - async getRelayerInfosAsync(): Promise<WebsiteBackendRelayerInfo[]> { - const result = await fetchUtils.requestAsync(utils.getBackendBaseUrl(), RELAYERS_ENDPOINT); - return result; - }, - async getTokenInfosAsync(): Promise<WebsiteBackendTokenInfo[]> { - const result = await fetchUtils.requestAsync(utils.getBackendBaseUrl(), TOKENS_ENDPOINT); - return result; - }, - async getWikiArticlesBySectionAsync(): Promise<ArticlesBySection> { - const result = await fetchUtils.requestAsync(utils.getBackendBaseUrl(), WIKI_ENDPOINT); - return result; - }, - async subscribeToNewsletterAsync(email: string): Promise<Response> { - const result = await fetchUtils.postAsync(utils.getBackendBaseUrl(), SUBSCRIBE_SUBSTACK_NEWSLETTER_ENDPOINT, { - email, - referrer: window.location.href, - }); - return result; - }, -}; |