Skip to content

Commit

Permalink
improve api structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Egesiapres committed Oct 23, 2023
1 parent b29cd6a commit cb80f06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/api/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { get, geolocationUrl, API_KEY } from './api.js';
*/

export const getGeocoding = (
cityName = 'milan',
cityName = '',
countryCode = '',
limit = '5',
stateCode = '',
Expand Down
6 changes: 5 additions & 1 deletion js/api/weather.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { get, dataUrl, API_KEY } from './api.js';

/**
* Generate the url to obtain the current weather data of a city
* Generate the url to obtain the current weather/dive days forecast data of a city
*
* @param {string} lat - The city latitude (req)
* @param {string} lon - The city longitude (req)
Expand All @@ -11,3 +11,7 @@ import { get, dataUrl, API_KEY } from './api.js';

export const getCurrentWeather = (lat, lon, APIkey = API_KEY) =>
get(dataUrl, `/weather?lat=${lat}&lon=${lon}&appid=${APIkey}`);

export const getFiveDayForecast = async (lat, lon, APIkey = API_KEY) => {
return get(dataUrl, `/forecast?lat=${lat}&lon=${lon}&appid=${APIkey}`);
};

0 comments on commit cb80f06

Please sign in to comment.