format document

This commit is contained in:
Jonas Leder 2022-03-08 12:19:39 +01:00
parent 63c2fde0de
commit f132ba2c55
No known key found for this signature in database
GPG key ID: 8A53DD45A7D7B44B

View file

@ -8,24 +8,24 @@ class blogFooter extends HTMLElement {
let ul = document.createElement("ul");
this.appendChild(ul);
var graphql = JSON.stringify({
query: 'query($count: Int!) { blogPosts(count: $count) { title id }}',
variables: {
"count": 5
}
})
var requestOptions = {
method: 'POST',
body: graphql,
};
let posts = (await (await fetch("http://localhost:1234/API/graphql.php", requestOptions)).json()).data.blogPosts;
posts.forEach((element) => {
let li = document.createElement("li");
let a = document.createElement("a");
a.href = "/post.html?id=" + element["id"];
a.innerText = element["title"];
li.appendChild(a);
ul.appendChild(li);
});
query: 'query($count: Int!) { blogPosts(count: $count) { title id }}',
variables: {
"count": 5
}
})
var requestOptions = {
method: 'POST',
body: graphql,
};
let posts = (await (await fetch("http://localhost:1234/API/graphql.php", requestOptions)).json()).data.blogPosts;
posts.forEach((element) => {
let li = document.createElement("li");
let a = document.createElement("a");
a.href = "/post.html?id=" + element["id"];
a.innerText = element["title"];
li.appendChild(a);
ul.appendChild(li);
});
}
}