13 lines
527 B
JavaScript
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 {}
|
|
});
|