Weird behavior in TS api endpoint
Currently working on an api endpoint that fetches data from an external api and performs some updates then stores locally.
Solution:Jump to solution
```ts
POST = async(request) => {
fetch initial data...
const players: Map<string, Player> = new Map();
const teams: Map<string, Team> = new Map();...
2 Replies
Current function structure is as follows:
But on the response im only getting teams: Array(0) and same for players
I know its something with the async context but cant figure out how to get it to behave as intended
Ended up finding the solution, changed to a for await loop
Solution