Open smileydts opened 7 months ago
I tried to integrate the players api and got an error message in the console. Here is what copilot said about the error message. Do you have any idea about this?
Huh. I have exactly that code in the server (which is Flask). Push your latest changes so I can pull them down and try myself tonight. If you're still working on it in the meantime, tell the copilot that app.py
uses flask_cors just as it recommends, so what gives?
What's the error message that appears in the console?
I documented the URL wrong: it's actually get_players
. I fixed the call on the front end and the docs. Apparently that error message just means that something failed its "preflight" check, not necessarily that there was a problem with CORS. Bleh.
Anyway, the call will still fail because it's not getting the data it needs. In order to fix this, you'll have to pass the player_id that you got as a cookie as new data with second call. However, an important thing to know is that calls are by default asynchronous, meaning that it won't wait for the first call to return before issuing the second call. In other words, you have to explicitly tell it to wait so that it has the data it needs for the second call. Look at the async
, and especially await
, keywords for this.
Run /players call passing
player_id
. Get back list of players and display.