fix graphql using localhost for api

This commit is contained in:
Jonas Leder 2022-03-15 08:49:36 +01:00
parent 15b36397ae
commit a150b0c744
No known key found for this signature in database
GPG key ID: 8A53DD45A7D7B44B
8 changed files with 8 additions and 8 deletions

View file

@ -17,7 +17,7 @@ class blogFooter extends HTMLElement {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
}; };
let posts = (await (await fetch("http://localhost:1234/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) => {
let li = document.createElement("li"); let li = document.createElement("li");
let a = document.createElement("a"); let a = document.createElement("a");

View file

@ -16,7 +16,7 @@ class BlogIndex extends HTMLElement {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
}; };
let posts = (await (await fetch("http://localhost:1234/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) => {
const article = document.createElement("article"); const article = document.createElement("article");
article.classList.add("breakWord"); article.classList.add("breakWord");

View file

@ -15,7 +15,7 @@ class commentsDisplay extends HTMLElement {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
}; };
let comments = (await (await fetch("http://localhost:1234/API/graphql.php", requestOptions)).json()).data.comments; let comments = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.comments;
this.innerHTML = ""; this.innerHTML = "";
comments.forEach((element) => { comments.forEach((element) => {
const h3 = document.createElement("h3"); const h3 = document.createElement("h3");

View file

@ -12,7 +12,7 @@ class ebkBanner extends HTMLElement {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
}; };
let elementCount = (await (await fetch("http://localhost:1234/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) {
const h2 = document.createElement("h2"); const h2 = document.createElement("h2");
h2.classList.add("red"); h2.classList.add("red");

View file

@ -117,7 +117,7 @@ class newComment extends HTMLElement {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
}; };
let data = (await (await fetch("http://localhost:1234/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"){
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>"

View file

@ -60,7 +60,7 @@ class sellingTable extends HTMLElement {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
}; };
let elements = (await (await fetch("http://localhost:1234/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 => {
const tr = document.createElement("tr"); const tr = document.createElement("tr");
table.appendChild(tr); table.appendChild(tr);

View file

@ -36,7 +36,7 @@ async function loadPost() {
method: 'POST', method: 'POST',
body: graphql, body: graphql,
}; };
let post = (await (await fetch("http://localhost:1234/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"];
document.title = post["title"] + " - Jonas Leder"; document.title = post["title"] + " - Jonas Leder";

View file

@ -60,7 +60,7 @@
method: 'POST', method: 'POST',
body: graphql, body: graphql,
}; };
let mailAddress = (await (await fetch("http://localhost:1234/API/graphql.php", requestOptions)).json()).data.mailAddress; let mailAddress = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.mailAddress;
let button = document.getElementById("emailButton"); let button = document.getElementById("emailButton");
let emailElement = document.createElement("p"); let emailElement = document.createElement("p");