Created
November 1, 2017 02:29
-
-
Save zackcreach/0d935e8da57b8e66c3d947d732fef606 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
console.log('Starting instagram..'); | |
const fetchData = (url) => { | |
return fetch(url) | |
.then(data => data.json()) | |
.then(json => { | |
if (json) { | |
return Promise.resolve(json); | |
} else { | |
return Promise.reject(Error('json is undefined!')); | |
} | |
}) | |
} | |
const base = 'https://api.instagram.com/v1/users/self/media/recent/'; | |
const token = '1939114685.3b5403f.63f96726d3411134c1ab45bcfe56ec77c42'; | |
fetchData(`${base}?access_token=${token}`) | |
.then(data => console.log(data)) | |
.catch(error => console.error(error)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment