Skip to content
Snippets Groups Projects
Commit 64a82fe1 authored by Xiao Gui's avatar Xiao Gui Committed by xgui3783
Browse files

chore: prettify raceFetch

parent db60568f
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ export class AtlasViewerConstantsServices{
fetch(url),
new Promise((_, reject) => setTimeout(() => {
reject(`fetch did not resolve under ${this.TIMEOUT} ms`)
}, this.TIMEOUT))
}, this.TIMEOUT)) as Promise<Response>
])
/* TODO to be replaced by @id: Landmark/UNIQUE_ID in KG in the future */
......
......@@ -35,13 +35,13 @@ export class AtlasViewerDataService implements OnDestroy{
){
this.constantService.templateUrls.map(url =>
this.constantService.raceFetch(url)
.then((res: Response) => res.json())
.then(res => res.json())
.then(json => new Promise((resolve, reject) => {
if(json.nehubaConfig)
resolve(json)
else if(json.nehubaConfigURL)
this.constantService.raceFetch(json.nehubaConfigURL)
.then((res: Response) => res.json())
.then(res => res.json())
.then(json2 => resolve(
Object.assign({}, json, { nehubaConfig: json2 })
))
......
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