Skip to content

Instantly share code, notes, and snippets.

@zackcreach
Created November 1, 2017 02:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackcreach/0d935e8da57b8e66c3d947d732fef606 to your computer and use it in GitHub Desktop.
Save zackcreach/0d935e8da57b8e66c3d947d732fef606 to your computer and use it in GitHub Desktop.
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