use graphql variables for postid
This commit is contained in:
parent
4fb15ec6d5
commit
49fa8a89b8
1 changed files with 4 additions and 2 deletions
|
@ -27,8 +27,10 @@ async function loadPost() {
|
||||||
content.innerHTML = "<h1>404 - Post not found</h1>";
|
content.innerHTML = "<h1>404 - Post not found</h1>";
|
||||||
} else {
|
} else {
|
||||||
var graphql = JSON.stringify({
|
var graphql = JSON.stringify({
|
||||||
query: 'query {blogPost(id: "' + id + '") {content title}}',
|
query: 'query($postID: String!) {blogPost(id: $postID) {content title}}',
|
||||||
variables: {}
|
variables: {
|
||||||
|
"postID": id
|
||||||
|
}
|
||||||
})
|
})
|
||||||
var requestOptions = {
|
var requestOptions = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
Loading…
Reference in a new issue