sui/assets/js/data.js
Glauber Ferreira 5dc1f2558d
All checks were successful
Build and Push Image / Build and push image (push) Successful in 41s
first commit
2024-04-28 19:41:41 -03:00

17 lines
545 B
JavaScript
Executable File

function fetchAndRender (name) {
fetch(name + '.json')
.then(response => response.json())
.then(data => {
const mysource = document.getElementById(name + '-template').innerHTML;
const mytemplate = Handlebars.compile(mysource);
const myresult = mytemplate(data);
document.getElementById(name).innerHTML = myresult;
});
}
document.addEventListener('DOMContentLoaded', () => {
fetchAndRender('apps');
fetchAndRender('links');
fetchAndRender('providers');
});