set content type in graphql request
This commit is contained in:
parent
a6a470f8aa
commit
7b56fbbdcd
11 changed files with 14 additions and 2 deletions
|
@ -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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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() {
|
||||||
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"];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?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";
|
||||||
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 @@
|
||||||
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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue