set content type in graphql request

This commit is contained in:
Jonas Leder 2022-04-07 09:24:06 +02:00
parent a6a470f8aa
commit 7b56fbbdcd
No known key found for this signature in database
GPG key ID: CC3C488E27DFF5CA
11 changed files with 14 additions and 2 deletions

View file

@ -15,6 +15,7 @@ class blogFooter extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let posts = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPosts;
posts.forEach((element) => {

View file

@ -15,6 +15,7 @@ class BlogIndex extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let posts = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPosts;
posts.forEach((element) => {

View file

@ -14,6 +14,7 @@ class commentsDisplay extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let comments = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.comments;
this.innerHTML = "";

View file

@ -12,6 +12,7 @@ class contactMailButton extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let sitekey = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.sitekey;

View file

@ -11,6 +11,7 @@ class ebkBanner extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let elementCount = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.ebayKleinanzeigen.count;
if(elementCount > 0) {

View file

@ -15,6 +15,7 @@ class newComment extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let sitekey = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.sitekey;
@ -117,6 +118,7 @@ class newComment extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let data = (await (await fetch("/API/graphql.php", requestOptions)).json()).data;
if (data.newComment == "OK") {

View file

@ -59,6 +59,7 @@ class sellingTable extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let elements = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.ebayKleinanzeigen.elements;
elements.forEach(ad => {

View file

@ -11,6 +11,7 @@ class Skill extends HTMLElement {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let skills = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.skills;

View file

@ -29,6 +29,7 @@ async function loadPost() {
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let post = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPost;
content.innerHTML = post["content"];

View file

@ -1,5 +1,5 @@
<?php
use GraphQL\GraphQL;
use GraphQL\Server\StandardServer;
use GraphQL\Type\Schema;
require 'vendor/autoload.php';
@ -8,7 +8,8 @@ require "./lib/mysql.php";
require "./queries/queries.php";
$schema = new Schema([
'query' => $queryType
'query' => $queryType,
'mutation' => $mutationType,
]);
try {

View file

@ -59,6 +59,7 @@
var requestOptions = {
method: 'POST',
body: graphql,
headers: { 'Content-Type': 'application/json' }
};
let mailAddress = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.mailAddress;