website/js/customElements/skills.js
2022-03-08 11:15:41 +01:00

27 lines
No EOL
713 B
JavaScript

class Skill extends HTMLElement {
constructor() {
super();
this.getSkills();
}
async getSkills(){
var graphql = JSON.stringify({
query: "query {skills}"
})
var requestOptions = {
method: 'POST',
body: graphql,
};
let skills = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.skills;
skills.forEach(skill => {
const image = document.createElement("img");
image.classList.add("skills");
image.src = "/API/getFile.php?filename=" + skill;
this.appendChild(image);
});
}
}
customElements.define("jl-skills", Skill);