Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
3DClient4SimStadtAPI
Commits
e3030f47
Commit
e3030f47
authored
3 years ago
by
Kolokolnikova
Browse files
Options
Download
Email Patches
Plain Diff
-fixed bug in localshadowdata and localbuildinginformation
parent
b045e623
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/js/connectToAPI.js
+6
-7
public/js/connectToAPI.js
with
6 additions
and
7 deletions
+6
-7
public/js/connectToAPI.js
+
6
-
7
View file @
e3030f47
...
@@ -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
,
f
et
chs
hadow
D
ata
JSON
()).
then
((
response
)
=>
{
timeout
(
25000
,
g
et
LocalS
hadow
d
ata
()).
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
)))
*/
})
})
...
...
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