beginn frontend modularisierung

This commit is contained in:
ecki
2026-03-10 17:06:16 +01:00
parent 44623422bc
commit 6912e1cc39
4 changed files with 43 additions and 29 deletions
+6 -7
View File
@@ -284,13 +284,12 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
</div> </div>
<script src="js/api.js"></script> document.addEventListener("DOMContentLoaded",()=>{
<script src="js/resources.js"></script>
<script src="js/domains.js"></script>
<script src="js/ips.js"></script>
<script src="js/dashboard.js"></script>
<script src="js/infra.js"></script>
<script src="js/main.js"></script>
loadResources();
loadDomains();
loadCosts();
});
</body> </body>
</html> </html>
+2 -1
View File
@@ -1,3 +1,4 @@
const API="/resman/api"; const API="/resman/api";
async function api(url, options={}){ async function api(url, options={}){
@@ -14,9 +15,9 @@ async function api(url, options = {}) {
}catch(e){} }catch(e){}
alert("Fehler: "+msg); alert("Fehler: "+msg);
throw new Error(msg); throw new Error(msg);
} }
return res.json(); return res.json();
} }
+21
View File
@@ -0,0 +1,21 @@
const API="/resman/api";
async function api(url, options={}){
const res = await fetch(url, options);
if(!res.ok){
let msg="API error";
try{
const err=await res.json();
msg=err.error || msg;
}catch(e){}
alert("Fehler: "+msg);
throw new Error(msg);
}
return res.json();
}
+4 -11
View File
@@ -1,15 +1,8 @@
document.addEventListener("DOMContentLoaded",()=>{ document.addEventListener("DOMContentLoaded",()=>{
loadResources() loadResources();
loadCancelled() loadDomains();
loadCosts();
loadDomains() });
loadMapping()
loadCosts()
if(typeof loadInfrastructure === "function"){
loadInfrastructure()
}
})