Commit e3030f47 authored by Kolokolnikova's avatar Kolokolnikova
Browse files

-fixed bug in localshadowdata and localbuildinginformation

parent b045e623
...@@ -122,24 +122,23 @@ async function fetchDataJSON() { ...@@ -122,24 +122,23 @@ async function fetchDataJSON() {
document.getElementById("loader").style.visibility = "hidden" document.getElementById("loader").style.visibility = "hidden"
async function getLocalShadowdata() { async function getLocalShadowdata() {
// gets the response from the api and put it inside a constant // gets the response from localShadowData and put it inside a constant
const response = await fetch(localShadowData); const response = await fetch(localShadowData);
//the response have to be converted to json type file, so it can be used //the response have to be converted to json type file, so it can be used
const data = await response.json(); const data = await response.json();
console.log(data) console.log(data)
// shadowData=data;
return data; return data;
} }
function processData() { async function processData() {
console.log(coordinatesBB) console.log(coordinatesBB)
console.log("Waiting for data....") console.log("Waiting for data....")
shadowdata= await getLocalShadowdata()
timeout(25000, fetchshadowDataJSON()).then((response) => { timeout(25000, getLocalShadowdata()).then((response) => {
console.log(response) console.log(response)
shadowdata = response; shadowdata = response;
}).catch((error) => { //catching the error(no connection)/ timeout and displaying an alert for the user }).catch((error) => { //catching the error(no connection)/ timeout and displaying an alert for the user
// shadowdata= getLocalShadowdata();
console.log(shadowdata); console.log(shadowdata);
//loadLocalAPIshadowData here... //loadLocalAPIshadowData here...
}) })
...@@ -155,11 +154,11 @@ function processData() { ...@@ -155,11 +154,11 @@ function processData() {
calculateData(response); calculateData(response);
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
/*
fetch("/3dclient4simstadtapi/public/test/APIdata/buildingInformation.json") fetch("/3dclient4simstadtapi/public/test/APIdata/buildingInformation.json")
.then(response => response.text()) .then(response => response.text())
.then(text => calculateData( JSON.parse(text))) .then(text => calculateData( JSON.parse(text)))
*/
}) })
......
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