change little things

This commit is contained in:
unurled 2023-02-16 13:35:42 +00:00
parent e00ab6183c
commit bc6cb56261
3 changed files with 8 additions and 7 deletions

View file

@ -3,7 +3,7 @@ function saveText() {
const options = {method: 'POST', body: JSON.stringify({text: x}), headers: { 'Content-Type': 'application/json' }};
fetch('http://127.0.0.1:8000/api/edit', options)
fetch(location.protocol + '/api/edit', options)
.then((response) => response.text())
.then(data => {
redirectOrNot(data);
@ -12,6 +12,6 @@ function saveText() {
}
async function redirectOrNot(res) {
let url = "http://" + location.hostname + ":" + location.port
let url = location.protocol
location.href = url+res
}

View file

@ -2,7 +2,7 @@ function formLink() {
let x = document.getElementById("Token").value;
const options = {method: 'POST', headers: {Token: x}};
fetch('http://127.0.0.1:8000/login', options)
fetch(location.protocol + '/login', options)
.then((response) => response.text())
.then(data => {
redirectOrNot(data);
@ -12,6 +12,7 @@ function formLink() {
}
async function redirectOrNot(res) {
let url = "http://" + location.hostname + ":" + location.port
let url = location.protocol
location.href = url+res
}

View file

@ -1,5 +1,5 @@
!async function(){
let data = await fetch("http://localhost:8000/api")
let data = await fetch(location.protocol + "/api")
.then((response) => response.text())
.then(data => {
return data;