Skip to content

Commit b820b14

Browse files
authored
New geolocation service provider
Switch geolocation service provider to ipapi.co
2 parents 1ae3eca + aa98927 commit b820b14

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

script.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ window.addEventListener('DOMContentLoaded', async () => {
2929
const apiKey = userApiKey || defaultApiKey;
3030

3131
// Getting current user location
32-
const geoLocation = 'https://geolocation-db.com/json/';
32+
const geoLocation = 'https://ipapi.co/json/';
3333
const locationData = await fetch(geoLocation);
3434
const parsedLocation = await locationData.json();
35-
const currentUserLocation = parsedLocation.IPv4;
35+
const currentUserLocation = parsedLocation.ip;
3636

3737
const weatherApi = `https://api.weatherapi.com/v1/current.json?key=${apiKey}&q=${currentUserLocation}&aqi=no`;
3838

0 commit comments

Comments
 (0)