Last active
May 10, 2017 16:08
-
-
Save Louiefigz/bfae1c4ae3be3f170a3d8ef2c6d81a18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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