I'm relatively new to Typescript/Javascript and I am working on a function called setBias()
. In this function, I want to set all indices of this.articles[i].result
equal to the biased rating returned by the function
getBiasedRating(this.articles[i].url)
, which makes an API call. However, when I loop through each index using a for loop, I encounter multiple POST 500 (INTERNAL SERVER ERROR)
messages.
The strange thing is that when I directly assign the biased rating for the first index in this.articles[0]
without looping, it works perfectly fine:
async setBias() {
this.articles[0].result = await this.getBiasedRating(this.articles[0].url)
}
I cannot figure out why the for loop implementation is causing these errors. Any insight or explanation would be greatly appreciated!