Change api endpoints to use apiURL
This commit is contained in:
parent
4cf874ca77
commit
a0796dacc5
|
@ -3,7 +3,8 @@ let myChart;
|
||||||
|
|
||||||
async function fetchDataForChart(str) {
|
async function fetchDataForChart(str) {
|
||||||
try {
|
try {
|
||||||
const apiEndpoint = `https://api.baseddata.io/bitcoin_business_growth_by_country?cumulative_period_type=365 day&countries=${str}`;
|
const apiEndpoint = `${apiURL}/bitcoin_business_growth_by_country?cumulative_period_type=365 day&countries=${str}`;
|
||||||
|
console.log("Fetching from " + apiEndpoint);
|
||||||
const response = await fetch(apiEndpoint);
|
const response = await fetch(apiEndpoint);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
|
|
@ -3,8 +3,7 @@ async function fetchDataForTable() {
|
||||||
const dropdown = document.querySelector(".dropdownFilter");
|
const dropdown = document.querySelector(".dropdownFilter");
|
||||||
let selectedIndex = dropdown.selectedIndex;
|
let selectedIndex = dropdown.selectedIndex;
|
||||||
let selectedValue = dropdown.options[selectedIndex].value;
|
let selectedValue = dropdown.options[selectedIndex].value;
|
||||||
const apiEndpoint =
|
const apiEndpoint = `${apiURL}/bitcoin_business_growth_by_country?latest_date=true`;
|
||||||
"https://api.baseddata.io/bitcoin_business_growth_by_country?latest_date=true";
|
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
apiEndpoint + `&cumulative_period_type=${selectedValue}`,
|
apiEndpoint + `&cumulative_period_type=${selectedValue}`,
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,7 +3,7 @@ const myChart = echarts.init(document.getElementById("chart"));
|
||||||
|
|
||||||
async function fetchDataForChart() {
|
async function fetchDataForChart() {
|
||||||
try {
|
try {
|
||||||
const apiEndpoint = "https://api.baseddata.io/get_json/final__price.json";
|
const apiEndpoint = `${apiURL}/get_json/final__price.json`;
|
||||||
const response = await fetch(apiEndpoint);
|
const response = await fetch(apiEndpoint);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
|
|
@ -3,8 +3,7 @@ const myChart = echarts.init(document.getElementById("chart"));
|
||||||
|
|
||||||
async function fetchDataForChart() {
|
async function fetchDataForChart() {
|
||||||
try {
|
try {
|
||||||
const apiEndpoint =
|
const apiEndpoint = `${apiURL}/get_json/final__feerate_percentiles.json`;
|
||||||
"https://api.baseddata.io/get_json/final__feerate_percentiles.json";
|
|
||||||
const response = await fetch(apiEndpoint);
|
const response = await fetch(apiEndpoint);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
|
|
@ -3,8 +3,7 @@ const myChart = echarts.init(document.getElementById("chart"));
|
||||||
|
|
||||||
async function fetchDataForChart() {
|
async function fetchDataForChart() {
|
||||||
try {
|
try {
|
||||||
const apiEndpoint =
|
const apiEndpoint = `${apiURL}/get_json/final__hashrate.json`;
|
||||||
"https://api.baseddata.io/get_json/final__hashrate.json";
|
|
||||||
const response = await fetch(apiEndpoint);
|
const response = await fetch(apiEndpoint);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
|
|
@ -3,8 +3,7 @@ const myChart = echarts.init(document.getElementById("chart"));
|
||||||
|
|
||||||
async function fetchDataForChart() {
|
async function fetchDataForChart() {
|
||||||
try {
|
try {
|
||||||
const apiEndpoint =
|
const apiEndpoint = `${apiURL}/get_json/${filename}?period=${selectedValue}`;
|
||||||
"https://api.baseddata.io/get_json/final__miner_rewards.json";
|
|
||||||
const response = await fetch(apiEndpoint);
|
const response = await fetch(apiEndpoint);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
|
Loading…
Reference in New Issue