website/js/customElements/skills.js

28 lines
773 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({
2022-03-08 11:15:41 +01:00
query: "query {skills}"
2022-03-08 10:04:11 +01:00
})
var requestOptions = {
method: 'POST',
body: graphql,
2022-04-07 09:24:06 +02:00
headers: { 'Content-Type': 'application/json' }
2022-03-08 10:04:11 +01:00
};
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);