From 49fa8a89b88f952de8580a272e8744281d0e7faf Mon Sep 17 00:00:00 2001 From: Jonas Leder <jonas.leder@jobrouter.com> Date: Tue, 8 Mar 2022 11:23:37 +0100 Subject: [PATCH] use graphql variables for postid --- js/viewPost.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/viewPost.js b/js/viewPost.js index 3c55634..c7e3d63 100644 --- a/js/viewPost.js +++ b/js/viewPost.js @@ -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', -- GitLab