ResMan update

This commit is contained in:
ecki
2026-03-09 18:20:41 +01:00
parent a244225887
commit 2b82941b44
3 changed files with 38 additions and 36 deletions
+13 -26
View File
@@ -835,23 +835,17 @@ document.getElementById("domainModal").style.display="none"
async function saveDomain(){
const id=document.getElementById("domain_id").value
const id = document.getElementById("domain_id").value
let cost=document.getElementById("domain_cost").value
let cost = document.getElementById("domain_cost").value
if(cost){
cost=cost.replace(",",".")
cost = cost.replace(",",".")
}
let domain=document.getElementById("domain_name").value
const data = {
/* https:// entfernen */
domain=domain.replace("https://","").replace("http://","").replace("/","")
const data={
domain_name:domain,
domain_name:document.getElementById("domain_name").value,
provider:document.getElementById("domain_provider").value,
ip_address:document.getElementById("domain_ip").value,
yearly_cost:cost || null,
@@ -859,11 +853,11 @@ notes:document.getElementById("domain_notes").value
}
/* speichern */
let response
if(id){
await fetch(API+"/domains/"+id,{
response = await fetch(API+"/domains/"+id,{
method:"PUT",
headers:{'Content-Type':'application/json'},
body:JSON.stringify(data)
@@ -871,7 +865,7 @@ body:JSON.stringify(data)
}else{
await fetch(API+"/domains",{
response = await fetch(API+"/domains",{
method:"POST",
headers:{'Content-Type':'application/json'},
body:JSON.stringify(data)
@@ -879,22 +873,15 @@ body:JSON.stringify(data)
}
/* DNS automatisch prüfen */
/* Fehler prüfen */
try{
if(!response.ok){
const dnsRes = await fetch(API+"/dns/"+domain)
const result = await dnsRes.json()
const err = await response.json()
if(result.ips && result.ips.length){
alert("Fehler: "+err.error)
data.ip_address=result.ips[0]
}
}catch(e){
console.log("DNS check failed")
return
}