Day:1
This commit is contained in:
12
public/assets/js/app.js
Normal file
12
public/assets/js/app.js
Normal file
@@ -0,0 +1,12 @@
|
||||
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 {}
|
||||
});
|
||||
Reference in New Issue
Block a user