Skip to content

Commit

Permalink
update ip-adress request
Browse files Browse the repository at this point in the history
  • Loading branch information
wjwei-handsome committed Oct 21, 2024
1 parent a202bc5 commit 1750b09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/BentoLayout/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ export default function MapChart() {
useEffect(() => {
// Fetch the location
const fetchLocation = async () => {

try {
const response = await axios.get(`http://ip-api.com/json/${ip}?fields=lat,lon`);
const response = await axios.get(`https://api.ipgeolocation.io/ipgeo?apiKey=3d7070bf4ff443adb464ffd5b4c54092&fields=geo&ip=${ip}`);
setLocation({ latitude: response.data.lat, longitude: response.data.lon });
console.log(response.data);
} catch (error) {
Expand Down

0 comments on commit 1750b09

Please sign in to comment.