diff --git a/js/index.js b/js/index.js index 7f989db..413bdee 100644 --- a/js/index.js +++ b/js/index.js @@ -8,8 +8,11 @@ import coinBlackList from './coin-blacklist'; import formatDollars from './format-dollars'; import formatHashrate from './format-hashrate'; +const IS_DEV = document.location.hostname === 'localhost'; const BITOIN_CONFIRMATIONS = 6; +const API = IS_DEV ? '/api/data' : 'https://howmanyconfs.com/api/data' + document.querySelector('.version').textContent = `v${version}`; const table = document.querySelector('table.results'); @@ -79,7 +82,7 @@ const render = (coins, sortBy) => { document.dispatchEvent(new Event('prerender-trigger')); }; -fetch('/api/data') +fetch(API) .then(response => response.json()) .then(coins => { const bitcoin = coins.find(coin => coin.symbol === 'BTC'); diff --git a/package.json b/package.json index a2da5ab..fa5be63 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,11 @@ "xo": { "env": "browser" }, + "prerender": { + "rendererConfig": { + "renderAfterDocumentEvent": "prerender-trigger" + } + }, "dependencies": { "babel-polyfill": "^6.26.0", "coinlist": "^3.1.2",