Skip to content
GitLab
Explore
Projects
Groups
Snippets
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
3 years ago
by
Kolokolnikova
Browse files
Options
Download
Email Patches
Plain Diff
implemented getLocalShadowData()
parent
47a4c7d8
master
dev
1 merge request
!1
Finale Merge of the dev branch into master
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/js/connectToAPI.js
+12
-6
public/js/connectToAPI.js
with
12 additions
and
6 deletions
+12
-6
public/js/connectToAPI.js
+
12
-
6
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...
})
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets