Mise à jour : dernières modifs
This commit is contained in:
23
frontend/public/assets/main.js
Normal file
23
frontend/public/assets/main.js
Normal file
@@ -0,0 +1,23 @@
|
||||
(async function(){
|
||||
const tournaments = await SSAPI.get('/tournaments').catch(()=>[]);
|
||||
const matches = await SSAPI.get('/matches').catch(()=>[]);
|
||||
|
||||
const tWrap = document.getElementById('tournaments');
|
||||
tWrap.innerHTML = tournaments.map(t=>`
|
||||
<div class="card">
|
||||
<strong>${t.name}</strong><br>
|
||||
${t.location || ''}<br>
|
||||
${t.start_date} → ${t.end_date}
|
||||
</div>
|
||||
`).join('') || '<p class="muted">Aucun tournoi</p>';
|
||||
|
||||
const mWrap = document.getElementById('matches');
|
||||
mWrap.innerHTML = matches.map(m=>`
|
||||
<div class="card">
|
||||
<div><strong>${m.round || 'Match'}</strong> — ${m.court || 'Court ?'}</div>
|
||||
<div>Teams: ${m.team_a_id || '?'} vs ${m.team_b_id || '?'}</div>
|
||||
<div>Score: ${m.score_a} - ${m.score_b} (${m.status})</div>
|
||||
<div>${m.scheduled_at ? new Date(m.scheduled_at).toLocaleString() : ''}</div>
|
||||
</div>
|
||||
`).join('') || '<p class="muted">Aucun match</p>';
|
||||
})();
|
||||
Reference in New Issue
Block a user