test
This commit is contained in:
@@ -3,7 +3,6 @@ let api_url = "https://timelapse.kerboul.me/api";
|
||||
let global_project_list;
|
||||
let current_project = "";
|
||||
|
||||
|
||||
function formatDate(isoString) {
|
||||
const date = new Date(isoString);
|
||||
|
||||
@@ -14,32 +13,33 @@ function formatDate(isoString) {
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
second: "numeric",
|
||||
timeZoneName: "short"
|
||||
timeZoneName: "short",
|
||||
};
|
||||
|
||||
return date.toLocaleString("en-US", options);
|
||||
}
|
||||
const readableString = date.toLocaleString("en-US", options);
|
||||
console.log(readableString);
|
||||
// Function to get data from API
|
||||
|
||||
function getDataFromApi() {
|
||||
// const cachedData = localStorage.getItem("project_list");
|
||||
// if (cachedData) {
|
||||
// // If the data is in the cache, parse it and return it
|
||||
// return Promise.resolve(JSON.parse(cachedData));
|
||||
// } else {
|
||||
// If the data is not in the cache, make the API request
|
||||
return $.ajax({
|
||||
url: api_url.concat("/itemsdb"),
|
||||
method: "GET",
|
||||
dataType: "json",
|
||||
}).then(data => {
|
||||
// If the request is successful, store the data in the cache and return it
|
||||
localStorage.setItem("project_list", JSON.stringify(data));
|
||||
return data;
|
||||
});
|
||||
// }
|
||||
function getDataProjectFromApi() {
|
||||
return $.ajax({
|
||||
url: api_url.concat("/itemsdb"),
|
||||
method: "GET",
|
||||
dataType: "json",
|
||||
}).then((data) => {
|
||||
// If the request is successful, store the data in the cache and return it
|
||||
localStorage.setItem("project_list", JSON.stringify(data));
|
||||
return data;
|
||||
});
|
||||
}
|
||||
function getDataProjectMetricsFromApi(id) {
|
||||
return $.ajax({
|
||||
url: api_url.concat(`/metric/${id}`),
|
||||
method: "GET",
|
||||
dataType: "json",
|
||||
}).then((data) => {
|
||||
// If the request is successful, store the data in the cache and return it
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
// Function to send data to API
|
||||
|
||||
Reference in New Issue
Block a user