fixed localhost url issue

This commit is contained in:
Alex / Awex
2021-06-26 03:14:12 -04:00
parent c1e1a2376d
commit 0d792dabb3
+4 -3
View File
@@ -1,8 +1,8 @@
let url = window.location.href let url = window.location.hostname
async function getFileUrl() { async function getFileUrl() {
const params = new URLSearchParams(window.location.search) const params = new URLSearchParams(window.location.search)
let title = params.get('photo') let title = params.get('photo')
let apiurl = `http://localhost:1337/screenshots?title=${title}` let apiurl = `http://${window.location.hostname}/screenshots?title=${title}`
if(title) { if(title) {
try{ try{
@@ -35,8 +35,9 @@ async function getFileUrl() {
} }
async function deleteSS() { async function deleteSS() {
let title = params.get('photo')
var secret = document.querySelector("#secret").value var secret = document.querySelector("#secret").value
const delfile = await fetch(url, { const delfile = await fetch(`http://${window.location.hostname}/delete/${title}`, {
method: "DELETE", method: "DELETE",
headers: { "secret": `${secret}`} headers: { "secret": `${secret}`}
}) })