summaryrefslogtreecommitdiff
path: root/assets/js/data.js
blob: 5f45926fde3b9e3d288de6cc575abbaa25114a22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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');
});