|
|
|
|
@ -43,7 +43,12 @@ |
|
|
|
|
prefixTitle: '', |
|
|
|
|
retrieveData() { |
|
|
|
|
fetch('/tournament/{{ tournament.id }}/broadcast/json/') |
|
|
|
|
.then(res => res.json()) |
|
|
|
|
.then(res => { |
|
|
|
|
if (!res.ok) { |
|
|
|
|
throw new Error(`HTTP ${res.status}: ${res.statusText}`); |
|
|
|
|
} |
|
|
|
|
return res.json(); |
|
|
|
|
}) |
|
|
|
|
.then((data) => { |
|
|
|
|
this.paginatedMatches = this.paginate(data.matches, 8) |
|
|
|
|
this.paginatedGroupStages = this.paginate(data.group_stages, 4) |
|
|
|
|
@ -56,6 +61,25 @@ |
|
|
|
|
this.active = 1; // Reset to the first page |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch((error) => { |
|
|
|
|
console.error('Error fetching tournament data:', error); |
|
|
|
|
|
|
|
|
|
// If this tournament is in an iframe (part of event/club auto), notify parent |
|
|
|
|
if (window.parent !== window) { |
|
|
|
|
console.log('Notifying parent of tournament error'); |
|
|
|
|
window.parent.postMessage({ |
|
|
|
|
type: 'tournamentError', |
|
|
|
|
tournamentId: '{{ tournament.id }}', |
|
|
|
|
error: error.message |
|
|
|
|
}, '*'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set empty data to prevent further errors |
|
|
|
|
this.paginatedMatches = []; |
|
|
|
|
this.paginatedGroupStages = []; |
|
|
|
|
this.paginatedSummons = []; |
|
|
|
|
this.paginatedRankings = []; |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
paginateSummons(array) { |
|
|
|
|
let pageSize = 16 |
|
|
|
|
|