Last active
January 16, 2018 21:24
-
-
Save javierarques/35ac96fbf8bc012eaa1bcc83b5434941 to your computer and use it in GitHub Desktop.
fetchJsonp example: fetching Flickr feed images
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 fetchJsonp from 'fetch-jsonp'; | |
const endpoint = | |
'http://api.flickr.com/services/feeds/photos_public.gne?format=json&tags=Valencia&tagmode=any'; | |
const result = fetchJsonp(endpoint, { | |
jsonpCallback: 'jsoncallback', | |
timeout: 3000 | |
}); | |
result | |
.then(response => response.json()) | |
.then(json => { | |
console.log(json); | |
}) | |
.catch(function(err) { | |
console.log(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment