UBS/fetchTest.js
2024-12-23 16:35:40 -07:00

17 lines
465 B
JavaScript

const apiUrl = 'https://ubs.rtech.foundation/api/v1/info'; // Replace with your API URL
const interval = 1000; // 1 second
const callApi = async () => {
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error('Network response was not ok');
}
const data = await response.json();
console.log('API Response:', data);
} catch (error) {
console.error('Error calling API:', error.message);
}
};
setInterval(callApi, interval);