Refactor fetchData function and add getLink function
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
// Sample data - you can replace this with your actual dataset
|
// Sample data - you can replace this with your actual dataset
|
||||||
const data = [];
|
const data = [];
|
||||||
processor = new DataProcessor();
|
processor = new DataProcessor();
|
||||||
dateStart='2024-03-27%2011:47:11'
|
|
||||||
dateEnd="2024-03-27%2011:47:11"
|
|
||||||
|
|
||||||
// Function to create checkbox with label
|
// Function to create checkbox with label
|
||||||
function createCheckBox(id, label) {
|
function createCheckBox(id, label) {
|
||||||
@@ -110,9 +108,15 @@ function createFilterContainer() {
|
|||||||
document.body.appendChild(container);
|
document.body.appendChild(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to get the link for the get request
|
||||||
|
function getLink(startDate, endDate, node) {
|
||||||
|
return link = "http://getMeasurements?dateStart=" + startDate.toISOString() +
|
||||||
|
"&dateEnd=" + endDate.toISOString() +
|
||||||
|
"&node=" + node;
|
||||||
|
}
|
||||||
// Get request to fetch data from the server
|
// Get request to fetch data from the server
|
||||||
function fetchData() {
|
function fetchData(link) {
|
||||||
fetch("http://145.92.8.114/getMeasurements?dateStart=2024-03-27%2011:47:11&dateEnd=2024-03-28%2011:47:11&node=113")
|
fetch(link)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("Network response was not ok");
|
throw new Error("Network response was not ok");
|
||||||
|
Reference in New Issue
Block a user