use graphql variables for postid

This commit is contained in:
Jonas Leder 2022-03-08 11:23:37 +01:00
parent 4fb15ec6d5
commit 49fa8a89b8
No known key found for this signature in database
GPG key ID: 8A53DD45A7D7B44B

View file

@ -27,8 +27,10 @@ async function loadPost() {
content.innerHTML = "<h1>404 - Post not found</h1>";
} else {
var graphql = JSON.stringify({
query: 'query {blogPost(id: "' + id + '") {content title}}',
variables: {}
query: 'query($postID: String!) {blogPost(id: $postID) {content title}}',
variables: {
"postID": id
}
})
var requestOptions = {
method: 'POST',