mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-29 07:16:17 +01:00
Matthias Kretschmann
f3307082d1
* grab data from github-projects microservice bigchaindb/github-projects
* complete rewrite to get everything via Fetch API 🎉, polyfilled with github/fetch
* nicer experience for loading state
* style tweaks for hero community bar
35 lines
929 B
JavaScript
35 lines
929 B
JavaScript
|
|
//include whatwg-fetch/fetch.js
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
const url = 'https://bigchaindb-github.now.sh'
|
|
|
|
function injectData(data) {
|
|
const repos = data
|
|
|
|
// just grab the first item of array
|
|
// should always be bigchaindb/bigchaindb cause of ordering by most stars
|
|
const repo = repos[0]
|
|
const stars = repo.stars
|
|
const release = repo.release
|
|
|
|
document.getElementById('stars').innerText = stars
|
|
document.getElementById('stars').style.opacity = 1
|
|
document.getElementById('release').innerText = release
|
|
document.getElementById('release').style.opacity = 1
|
|
}
|
|
|
|
fetch(url)
|
|
.then(function(response) {
|
|
return response.json()
|
|
})
|
|
.then(function(data) {
|
|
injectData(data)
|
|
})
|
|
.catch(function(error) {
|
|
console.log(error)
|
|
})
|
|
|
|
})
|