Files
SuperSunday/public/assets/js/app.js
karim hassan e3620c7f42 Day:1
2025-08-18 19:30:47 +00:00

13 lines
527 B
JavaScript

async function api(path, opts={}){
const res = await fetch(path, { headers:{ 'content-type':'application/json' }, ...opts });
if (!res.ok) throw new Error(await res.text());
const ct = res.headers.get('content-type')||'';
return ct.includes('application/json')? res.json() : res.text();
}
document.addEventListener('DOMContentLoaded', async ()=>{
try {
const cfg = await api('/api/config');
const el = document.querySelector('.title'); if (el) el.textContent = cfg.siteName || 'Padel24Play';
} catch {}
});