Created
July 3, 2021 16:24
-
-
Save ElpixZero/33b719e1ecd212b77f5b556959306471 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const API_KEY = | |
"ce3fd966e7a1d10d65f907b20bf000552158fd3ed1bd614110baa0ac6cb57a7e"; | |
//TODO: refactor to use URLSearchParams | |
fetch( | |
`https://min-api.cryptocompare.com/data/pricemulti?fsyms=${[ | |
...tickersHandlers.keys() | |
].join(",")}&tsyms=USD&api_key=${API_KEY}` | |
) | |
//AFTER REFACTORING | |
const LOAD_TICKERS_API_ENDPOINT = new URL('https://min-api.cryptocompare.com/data/pricemulti'); | |
LOAD_TICKERS_API_ENDPOINT.searchParams.set('fsyms', [ | |
...tickersHandlers.keys() | |
].join(",")); | |
LOAD_TICKERS_API_ENDPOINT.searchParams.set('tsyms', 'USD'); | |
LOAD_TICKERS_API_ENDPOINT.searchParams.set('api_key', API_KEY); | |
fetch(LOAD_TICKERS_API_ENDPOINT.href) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment