format document
This commit is contained in:
parent
63c2fde0de
commit
f132ba2c55
1 changed files with 18 additions and 18 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue