Change api endpoints to use apiURL

This commit is contained in:
Sam 2024-08-14 17:59:38 +01:00
parent 4cf874ca77
commit a0796dacc5
6 changed files with 7 additions and 10 deletions

View File

@ -3,7 +3,8 @@ let myChart;
async function fetchDataForChart(str) {
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);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);

View File

@ -3,8 +3,7 @@ async function fetchDataForTable() {
const dropdown = document.querySelector(".dropdownFilter");
let selectedIndex = dropdown.selectedIndex;
let selectedValue = dropdown.options[selectedIndex].value;
const apiEndpoint =
"https://api.baseddata.io/bitcoin_business_growth_by_country?latest_date=true";
const apiEndpoint = `${apiURL}/bitcoin_business_growth_by_country?latest_date=true`;
const response = await fetch(
apiEndpoint + `&cumulative_period_type=${selectedValue}`,
);

View File

@ -3,7 +3,7 @@ const myChart = echarts.init(document.getElementById("chart"));
async function fetchDataForChart() {
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);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);

View File

@ -3,8 +3,7 @@ const myChart = echarts.init(document.getElementById("chart"));
async function fetchDataForChart() {
try {
const apiEndpoint =
"https://api.baseddata.io/get_json/final__feerate_percentiles.json";
const apiEndpoint = `${apiURL}/get_json/final__feerate_percentiles.json`;
const response = await fetch(apiEndpoint);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);

View File

@ -3,8 +3,7 @@ const myChart = echarts.init(document.getElementById("chart"));
async function fetchDataForChart() {
try {
const apiEndpoint =
"https://api.baseddata.io/get_json/final__hashrate.json";
const apiEndpoint = `${apiURL}/get_json/final__hashrate.json`;
const response = await fetch(apiEndpoint);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);

View File

@ -3,8 +3,7 @@ const myChart = echarts.init(document.getElementById("chart"));
async function fetchDataForChart() {
try {
const apiEndpoint =
"https://api.baseddata.io/get_json/final__miner_rewards.json";
const apiEndpoint = `${apiURL}/get_json/${filename}?period=${selectedValue}`;
const response = await fetch(apiEndpoint);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);