Last active
June 7, 2017 16:06
-
-
Save jssee/c903a39bc663b4693b3872bf04584d76 to your computer and use it in GitHub Desktop.
Use fetch to get your dribbble shots.
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
const url = 'https://api.dribbble.com/v1/users/USERNAME/shots?access_token=TOKEN&callback'; | |
fetch(url) | |
.then(response => response.json()) | |
.then(function(data) { | |
[].forEach.call(data, function(post) { | |
let list = document.querySelector('#dribbble'); | |
let html = ` | |
<li> | |
<a href="${post.html_url}" target="_blank"> | |
<img src="${post.images.normal}"> | |
</a> | |
</li> | |
`; | |
console.log(post); | |
list.innerHTML += html; | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions
USERNAME
with your dribbble username, replaceTOKEN
with your Client Access Token.