Skip to content
Snippets Groups Projects
Verified Commit 49fa8a89 authored by Jonas Leder's avatar Jonas Leder
Browse files

use graphql variables for postid

parent 4fb15ec6
Branches
No related tags found
1 merge request!8Rewrite API endpoint to graphql
Pipeline #7174 passed
...@@ -27,8 +27,10 @@ async function loadPost() { ...@@ -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',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment