Created
May 15, 2021 12:38
-
-
Save clement-joye/7ec89ddf2f34ad10e866d87b62c00eab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getCardData(card: DashboardCard, i: number = 0) { | |
let resource = card.resources[i]; | |
let variables = card.variables; | |
let request = prepareRequest(resource, variables, card.pat); | |
console.log(request.url); | |
return this.http.get<string>(request.url, { headers: request.httpOptions }).subscribe( | |
(data: string) => { | |
postRequest(data, resource, variables); | |
if(++i < card.resources.length) { this.getCardData(card, i); } | |
else { card.isLoading = false; } | |
}, | |
(error: any) => { | |
console.log(`Backend server returned an error (${error.status} - ${error.message})`); | |
card.isLoading = false; | |
card.variables['status'] = 'Unknown'; | |
} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment