website/js/customElements/skills.js

27 lines
723 B
JavaScript
Raw Normal View History

2021-11-18 06:57:23 +01:00
class Skill extends HTMLElement {
constructor() {
super();
2022-03-08 10:04:11 +01:00
this.getSkills();
}
async getSkills(){
var graphql = JSON.stringify({
query: "query {\r\n skills\r\n}"
})
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);
});
2021-11-18 06:57:23 +01:00
}
}
customElements.define("jl-skills", Skill);