fix new comment

This commit is contained in:
Jonas Leder 2022-04-07 09:26:20 +02:00
parent 7b56fbbdcd
commit 0f70b811f9
No known key found for this signature in database
GPG key ID: CC3C488E27DFF5CA

View file

@ -106,7 +106,7 @@ class newComment extends HTMLElement {
} }
var graphql = JSON.stringify({ var graphql = JSON.stringify({
query: 'mutation($article: String!, $name: String!, $hCaptchaResponse: String!, $email: String!, $comment: String!) { newComment(article: $article, name: $name, email: $email, comment: $comment, hCaptchaResponse: $hCaptchaResponse)}', query: 'mutation($article: String!, $name: String!, $hCaptchaResponse: String!, $email: String!, $comment: String!) { comment(article: $article, name: $name, email: $email, comment: $comment, hCaptchaResponse: $hCaptchaResponse)}',
variables: { variables: {
"article": pageName, "article": pageName,
"name": nameInput.value, "name": nameInput.value,
@ -121,7 +121,7 @@ class newComment extends HTMLElement {
headers: { 'Content-Type': 'application/json' } headers: { 'Content-Type': 'application/json' }
}; };
let data = (await (await fetch("/API/graphql.php", requestOptions)).json()).data; let data = (await (await fetch("/API/graphql.php", requestOptions)).json()).data;
if (data.newComment == "OK") { if (data.comment == "OK") {
document.querySelector("jl-comments_display").getComments(); document.querySelector("jl-comments_display").getComments();
parent.innerHTML = "<jl-new_comment></jl-new_comment>" parent.innerHTML = "<jl-new_comment></jl-new_comment>"
} else { } else {