Skip to content

Instantly share code, notes, and snippets.

@Louiefigz
Last active May 10, 2017 16:08
Show Gist options
  • Save Louiefigz/bfae1c4ae3be3f170a3d8ef2c6d81a18 to your computer and use it in GitHub Desktop.
Save Louiefigz/bfae1c4ae3be3f170a3d8ef2c6d81a18 to your computer and use it in GitHub Desktop.
import axios from 'axios';
const dailyWeather = "http://api.openweathermap.org/data/2.5/weather?q="
const tail = "&APPID=*****YOUR API*********"
const fiveDayWeather = "http://api.openweathermap.org/data/2.5/forecast/daily?q="
const fiveDayTail = "&cnt=5"
let WeatherFetcher = {
fetchDailyWeather: function(city) {
let url = dailyWeather + city + tail;
return axios.get(url);
},
fetchFiveDayWeather: function(city) {
let url = fiveDayWeather + city + tail + fiveDayTail;
return axios.get(url);
}
}
export default WeatherFetcher;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment