Joe-TheBro / wackyweathertext

2 stars 0 forks source link

chore: Refactor geocode functions #3

Closed Joe-TheBro closed 2 months ago

Joe-TheBro commented 2 months ago

I moved around some functions and variables to keep scope limited. This code changes technically work, but I still can't wrap my brain around why geocodeResponse has to be []geocodeResponse, the JSON response should be a single object. Idk maybe I messed up checking types or something.

clabbbbbbb commented 2 months ago

The JSON response from geocode.city API returns an array since that's just how the autocomplete endpoint works. If we got rid of "limit=1" parameter from our url and requested "https://api.geocode.city/autocomplete?q=Pierre" then we get multiple objects