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

set content type in graphql request

parent a6a470f8
Branches
Tags
No related merge requests found
...@@ -15,6 +15,7 @@ class blogFooter extends HTMLElement { ...@@ -15,6 +15,7 @@ class blogFooter extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let posts = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPosts; let posts = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPosts;
posts.forEach((element) => { posts.forEach((element) => {
... ...
......
...@@ -15,6 +15,7 @@ class BlogIndex extends HTMLElement { ...@@ -15,6 +15,7 @@ class BlogIndex extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let posts = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPosts; let posts = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPosts;
posts.forEach((element) => { posts.forEach((element) => {
... ...
......
...@@ -14,6 +14,7 @@ class commentsDisplay extends HTMLElement { ...@@ -14,6 +14,7 @@ class commentsDisplay extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let comments = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.comments; let comments = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.comments;
this.innerHTML = ""; this.innerHTML = "";
... ...
......
...@@ -12,6 +12,7 @@ class contactMailButton extends HTMLElement { ...@@ -12,6 +12,7 @@ class contactMailButton extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let sitekey = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.sitekey; let sitekey = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.sitekey;
... ...
......
...@@ -11,6 +11,7 @@ class ebkBanner extends HTMLElement { ...@@ -11,6 +11,7 @@ class ebkBanner extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let elementCount = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.ebayKleinanzeigen.count; let elementCount = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.ebayKleinanzeigen.count;
if(elementCount > 0) { if(elementCount > 0) {
... ...
......
...@@ -15,6 +15,7 @@ class newComment extends HTMLElement { ...@@ -15,6 +15,7 @@ class newComment extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let sitekey = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.sitekey; let sitekey = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.sitekey;
...@@ -117,6 +118,7 @@ class newComment extends HTMLElement { ...@@ -117,6 +118,7 @@ class newComment extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
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.newComment == "OK") {
... ...
......
...@@ -59,6 +59,7 @@ class sellingTable extends HTMLElement { ...@@ -59,6 +59,7 @@ class sellingTable extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let elements = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.ebayKleinanzeigen.elements; let elements = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.ebayKleinanzeigen.elements;
elements.forEach(ad => { elements.forEach(ad => {
... ...
......
...@@ -11,6 +11,7 @@ class Skill extends HTMLElement { ...@@ -11,6 +11,7 @@ class Skill extends HTMLElement {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let skills = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.skills; let skills = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.skills;
... ...
......
...@@ -29,6 +29,7 @@ async function loadPost() { ...@@ -29,6 +29,7 @@ async function loadPost() {
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let post = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPost; let post = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.blogPost;
content.innerHTML = post["content"]; content.innerHTML = post["content"];
... ...
......
<?php <?php
use GraphQL\GraphQL; use GraphQL\Server\StandardServer;
use GraphQL\Type\Schema; use GraphQL\Type\Schema;
require 'vendor/autoload.php'; require 'vendor/autoload.php';
...@@ -8,7 +8,8 @@ require "./lib/mysql.php"; ...@@ -8,7 +8,8 @@ require "./lib/mysql.php";
require "./queries/queries.php"; require "./queries/queries.php";
$schema = new Schema([ $schema = new Schema([
'query' => $queryType 'query' => $queryType,
'mutation' => $mutationType,
]); ]);
try { try {
... ...
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
var requestOptions = { var requestOptions = {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
headers: { 'Content-Type': 'application/json' }
}; };
let mailAddress = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.mailAddress; let mailAddress = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.mailAddress;
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment