Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
3DClient4SimStadtAPI
Commits
3e74ace5
Commit
3e74ace5
authored
Dec 16, 2021
by
Kolokolnikova
Browse files
implemented getLocalShadowData()
parent
47a4c7d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/js/connectToAPI.js
View file @
3e74ace5
...
...
@@ -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
(
shadow
data
);
//loadLocalAPIshadowData here...
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment