redxzeta / Awesome-Adoption

pet adoption near your area
https://pawternityhub.netlify.app/
MIT License
59 stars 132 forks source link

Feature suggestion - Geolocation #132

Closed Seagullible closed 3 years ago

Seagullible commented 3 years ago

If we added geolocation, we could give the user's zip code to the Petfinder API call right away. That way, the animals that show up on the home page would be results from the user's zip code, instead of the default 19019.

It would be best to do some research and find the least intrusive geolocation library for this, as we would just need the zip code. We might be able to do this with the built-in React geolocation, which provides latitutde/longitude. In that case this would be a straightforward change.

redxzeta commented 3 years ago

yea looks like you could do lat and longitude

image

panchoroo commented 3 years ago

Hello, this is my first issue but I'd like to work on this. I have it running on local and I'm getting latitude and longitude but I'm not quite sure how to get postal code from that. Where did you get the above screenshot from?

redxzeta commented 3 years ago

its from the pet finder api

https://www.petfinder.com/developers/v2/docs/

url with zipCode in PetType.js

  axios
        .get(
          `https://api.petfinder.com/v2/animals?type=${type}&location=${zipCode}&limit=12&page=${
            page || 1
          }`,
          config
        )
panchoroo commented 3 years ago

Oh, so the user can either allow location and the pet finder can pass in latitude and longitude to get the pets OR they provide their zip code? I just want to make sure I'm understanding the use case.

redxzeta commented 3 years ago

yea