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);