mirror of
https://github.com/LucasKalil-Programador/world-2026-hub.git
synced 2026-07-04 17:41:28 -03:00
feat(cache): add cache-busting version for data files
This commit is contained in:
parent
6d835b43b9
commit
da8a8838c6
3 changed files with 17 additions and 2 deletions
|
|
@ -14,12 +14,14 @@ import { initBracket } from './bracket.js';
|
|||
|
||||
let data = null;
|
||||
|
||||
const DATA_VERSION = '2026-06-13-rev1';
|
||||
|
||||
export async function loadData() {
|
||||
if (data) return data;
|
||||
const files = ['teams', 'groups', 'matches', 'results', 'stadiums', 'bracket-config'];
|
||||
const [teams, groups, matches, results, stadiums, bracketConfig] = await Promise.all(
|
||||
files.map(async (name) => {
|
||||
const res = await fetch(`data/${name}.json`);
|
||||
const res = await fetch(`data/${name}.json?v=${DATA_VERSION}`);
|
||||
if (!res.ok) throw new Error(`data/${name}.json — HTTP ${res.status}`);
|
||||
return res.json();
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue