Commit 3e74ace5 authored by Kolokolnikova's avatar Kolokolnikova
Browse files

implemented getLocalShadowData()

parent 47a4c7d8
......@@ -5,7 +5,7 @@ var url2 = "http://vm24.fkc.hft-stuttgart.de:8082/workflow/timedShadowValueByDay
/*TODO#1: -get current data from the api and create local test data (apiData foler)
-add connection handeling (error messages when there isnt a connection and then using the local test data)
*/
var localShadowData = "/3dclient4simstadtapi/public/test/APIdata/shadowData.json"
var buildingFunctionSort
var constructionYearSortPick
......@@ -91,19 +91,25 @@ const response = await fetch(url, {
document.getElementById("loader").style.visibility = "hidden"
async function getLocalShadowdata(){
// gets the response from the api and put it inside a constant
const response = await fetch(localShadowData);
//the response have to be converted to json type file, so it can be used
const data = await response.json();
console.log(data)
// shadowData=data;
return data;
}
function processData() {
console.log(coordinatesBB)
console.log("Waiting for data....")
timeout(25000, fetchshadowDataJSON()).then((response)=>{
console.log(response)
shadowdata = response ;
}).catch((error)=>{ //catching the error(no connection)/ timeout and displaying an alert for the user
console.log("Using local test data");
// shadowdata= getLocalShadowdata();
console.log(shadowdata);
//loadLocalAPIshadowData here...
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment